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 / [Dark Physics] Creating Doors.. really, how?

Author
Message
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 12:47
Hey,
yesterday i wrote a simple door code that worked perfectly.
but when adding DP to it things stopped working again.

this is my door:


this is my DBPRO Code:


if i remove the DP code, it works perfect as i just said.
but when the dp code is implemented, some doors don't open and other doors rotate 180 degrees then stop (not increased by 1 as it should be, but increased by 180 each step).

so, anyone know what is wrong with this?

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Oct 2006 13:10
You maybe having a code lock with the following variables

dooropen(c)
opendoor( c )
closedoor(c)

If there state's are not exactly what you think they should be then it gets stuck.

try keeping it to one variable easier to check.

good luck on finding your error as I cannot see one that could be it.

Dark Physics makes any hot drink go cold.
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 13:17
did you mean that instead of

i should do this:

because that gives me the same result.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Oct 2006 13:30
something like
Entity( c ).Door.Action = "open" ` OPEN THE DOOR

Entity( c ).Door.Action = "close" ` OPEN THE DOOR

then you check is it "open" or "close"

like so
If Entity( c ).Door.State = 0 ` DOOR IS CLOSED
Entity( c ).Door.State = 1
Entity( c ).Door.Action = "open" ` OPEN THE DOOR
Else ` DOOR IS OPEN
Entity( c ).Door.Action = "close"` CLOSE THE DOOR
Entity( c ).Door.State = 0
EndIf

what I'm trying to say is make it work the same way you would for a mouseclick button.

Dark Physics makes any hot drink go cold.
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 13:48 Edited at: 1st Oct 2006 13:52
ok, i see what you mean now.
but my code works when i don't have darkphysics to the door.
so i don't understand how that other trigger based code should make any difference.

oh and i just noticed that the door is somewhat inside the wall.
would that cause any trouble do you think? that the door is stuck in the wall or something?

edit,
i scaled the door and it didn't make any difference if it was inside the wall or not.
i will try your suggestion then.

Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 1st Oct 2006 13:59
To work correctly the door does have to be slightly smaller than the opening. Otherwise it gets stuck and behaves oddly. Just follow the example in the Dark Physics examples, it's pretty clear about doors.


Come see the WIP!
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 14:29
ok then,
* i created the door dynamic instead of static
* i added a revolute joint at the door position
* when i press 'e' the door get a push
it works, almost.

would it not be possible to do what i originally intended?

i wanted to be able to click 'e' and the door opens up 90degrees.
when at 90degrees the door state is set to "opened".
if the state is "opened" and i press 'e' again, the dore moves backwards to 0degrees. the state is set to "closed".

this is how it is now:
the door is closed, and i press 'e'. the door opens and moves back and forth colliding with the wall and it never stops.

this was harder than i first thought.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Oct 2006 14:50
Lukas W are you making a swing door or normal one, if normal go look at a real one, there you'll find a bit of wood down one side that stops the door swing throu to the other side.

As I found out when you apply physics to something it now needs to work like the real thing.

Dark Physics makes any hot drink go cold.
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 16:28
it is a normal door, and not a swing door.
you are right about that. i'll see if i can set the joint to not rotate more than a certain angle because i don't want to remake the whole map.

Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 17:10
could somebody have a look at this attached code?

as you can see, the door opens just fine without DP code.
if you unrem the DP code, and rem out the DB rotation code, you will notice that the code is the same, but the result is far from correct.

maybe this is a bug? that the "Phy Set Rigid Body Rotation" isn't working how it should?

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Oct 2006 18:15
ok got some thing working when it closes, taken out and added these lines.






hope you workout where they come from, its to do with you have DBpro object commands fighting with Physics commands.

see how you get on with the above.

Dark Physics makes any hot drink go cold.
Lukas W
20
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 1st Oct 2006 20:46
I found a workaround.
don't know how much memory it eats but here goes:

When the door must open or close, delete the rigid body and the revolute joint.
Rotate the DBPro object, and then recreate the dynamic rigid body and the revolute joint, with the new angle of the door.

it works quite good, but sometimes the door rotate a bit on the X or Z axis, but it fixes itself too.

does DarkPhysics support UpVectors like Newton?
so that it will allways face upwards, and not be able to rotate on the X or Z axis.

i attached the code for my method here, in case somebody else have the same problem.

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-24 23:37:55
Your offset time is: 2024-04-24 23:37:55