Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / [DP] My door will not open properly

Author
Message
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 25th Jul 2007 21:50
Hello,
I am currently working on the Door Module for my project 'Alone'.

I want to have different kinds of doors (I'm starting with the easy ones to make first, in order to at the same time learn DP.)


This is my current code:

If you run this snippet you will see that the doors open fine.
That is because I don't have DP implemented.

When I implement DP (just remove the ` marks) or simply copy and paste:

The doors are not able to fully open. They should reach an Ypos value of 224.99etc but instead the reach something like 180 then the yPos value decreases. When it reach the floor again, it will jump up to WAY above 225 :/

Any thoughts about this topic?

Kendor
21
Years of Service
User Offline
Joined: 31st Jan 2003
Location: Malta
Posted: 25th Jul 2007 23:50 Edited at: 25th Jul 2007 23:53
Your problem is that when you move your object, a force is applied and thus the object will continue to move until that force is exhausted. To solve this problem you have 2 options.

Option 1 (better than option 2)

If the doors will move only up and down i.e. they will not interact apart from collision, the solution is to setup the object is kinematic. This will allow you to control the object without it being affected by other forces such as gravity.




Option 2:

If, on the other hand, you want the door to interact with the player e.g. player smashing the door instead of opening it, thus requiring gravity etc, you need to set the linear velocity of the object to zero every loop.



Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.
Syncaidius
19
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: United Kingdom
Posted: 26th Jul 2007 00:00 Edited at: 26th Jul 2007 00:01
@kendor:
Ahh damn, you beat me to it.

@Lucas W:

II've added a bit of code so the doors can be shut as well as open. They wouldn't shut in yours or kendors code, so here it is:



It's pretty much the same as kendor's first piece, except the doors shut.

Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 26th Jul 2007 00:10
Thanks,
I will experiment around with this.
Hopefully I will be able to create the doors I want to.

Login to post a reply

Server time is: 2024-05-04 03:16:31
Your offset time is: 2024-05-04 03:16:31