Product Chat / collision when animating.

Author
Message
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 6th Jan 2017 17:24
i have made a door with box colision when i try to rotate it with lua the mesh totates like it should be but the collision box stays at its original position so even the door looks open i cant get pass and the actual mesh has no colision.
i want to make a door without using the disable collision becouse when the door is open you can pass throught the door mesh when its open and thats is not realistic
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 6th Jan 2017 17:48
We do not really have all that much collision control in scripting yet.

From a model and animation stand point, one could make two door objects and when the door become open, hide the original and spawn the other one that was oriented different in the model program. Then switch back with scripting when the door becomes closed. Retaining the collision and animation of the first one, and having collision on when the door is opened.

We have so clever users around hear. Maybe something can be worked out.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 6th Jan 2017 18:34
Separate the door and move it under Lua control, much smoother that way I reckon. (look for my ezentitymover script to see how it's done)
Been there, done that, got all the T-Shirts!
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th Jan 2017 01:22
But will you have collision when the door is in the open position? This is an object rotated by a script, not animation driven.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Jan 2017 01:39
Yes, you turn off collisions, move the entity and then turn collisions back on (this in itself has problems depending in the entities collision mode) but it is how my platforms work, the player does not fall through the platform!

The problem only arises if the entity has polygon collision rather than box collision because when you use the Lua CollisonOff/CollisionOn combo it appears to default the collision mode to box rather than polygon.

Doors are usually box mode so this problem does not arise.
Been there, done that, got all the T-Shirts!
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th Jan 2017 03:08
Quote: "i have made a door with box collision when i try to rotate it with lua the mesh rotates like it should be but the collision box stays at its original position so even the door looks open i cant get pass and the actual mesh has no collision."


What the OP is trying to achieve.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 7th Jan 2017 11:52
I think if you don't do the CollisionOff/CollisionOn trick the collision box does not get updated to the new position.

i.e.
CollisionOff(e)
SetRotation(e, 0, 90, 0)
CollisionOn(e)

(or use ezentitymover script which gives smooth frame by frame movements and can handle any number of doors, platforms, trigger plates etc)
Been there, done that, got all the T-Shirts!
PM
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 7th Jan 2017 15:24
Cool. Thanks.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Login to post a reply

Server time is: 2024-11-24 19:05:13
Your offset time is: 2024-11-24 19:05:13