Animating a door...

Blitz3D Forums/Blitz3D Programming/Animating a door...

Chroma(Posted 2006) [#1]
Don't do it! Because even though the door looks open, it really isn't! Guess I gotta make me a door open function the takes the door and swings it xxx degrees.


Matty(Posted 2006) [#2]
Hi Chroma - it can be done, just differently - instead turn off collisions for the door while it is open, or use a separate collision mesh which follows the 'opening door' movement without using the animation commands.

There are many ways of doing it.


Boiled Sweets(Posted 2006) [#3]
I use trap doors in qoob and just hide the door entity when it's open. Simple but perhaps not what you want.


OrcSlayer(Posted 2006) [#4]
Actually yes, there are many ways of doing this...it's something I've had to consider and I came up with many ways, some better or more efficient than others...I am currently looking at doors having a seperate "collision hull" that has polygon collision when the door is closed and no collision when it's open.


jfk EO-11110(Posted 2006) [#5]
I think you were talking about an animated Mesh of a door? Did you use a boned Format? Because, if you use 3DS or X with child objects, like rotation cubes etc (rotate/scale/move), then it should work IF you apply collision to the children recursively.

That said, if your character is walking agains a door that is swinging right towards him, then it's most likely that he will walk right trough it, unless you perform an additional updateworld between the two movements/rotations (player vs door collision). But this will also happen if you use a static door mesh and rotate it by code.

an other simple solution for the swinging door collision problem is: apply invisble boxes to each side of the door. Then only if the distance from door to player is low test for MeshesIntersect and pause the door swing thing until they don't intersect any longer. It may be better to attach a box also to the player, for the sake of a faster meshesintersect execution.


Chroma(Posted 2006) [#6]
It's a .b3d with a bone used to swing the door open and turn the doorknob. I open the door by clicking on it and triggering the open sequence. Then close it by clicking again and playing the close sequence. When the door is open i need to be able to click on it to close it so i'm thinking i do have to manually open it with a function. Unless this new info sheds some light for one of you..


OrcSlayer(Posted 2006) [#7]
I'd just recommend you create a door class and manually animate it with code, so you can give it polygon pick mode (which is what I gather from reading that). There is a way to do it with an animated mesh, but it's a bit more complicated (parenting static meshes to the bones of the animated mesh to make them move with it).


John Blackledge(Posted 2006) [#8]
I thought there was a new command in the last version of Blitz for this very reason - or did I just dream it?


Chroma(Posted 2006) [#9]
Um...how do you find the child in a .b3d?


kevin8084(Posted 2006) [#10]
GetChild or FindChild...you need to enumerate through all children of the parent entity with CountChildren


Naughty Alien(Posted 2006) [#11]
why you just simply put pivot of door mesh exactly in center of rotation and import door as separate object..its easy to set up colision, working much more faster and doesnt require bones..


Chroma(Posted 2006) [#12]
Yeah but I was trying to use just use animation from the modeler to open it and using bones. I'm sidetracked with a quick project but I'll get back to it! =)


jfk EO-11110(Posted 2006) [#13]
John, I think you meant the CullBox command. Has nothing to do with collision, it's only an explicit render inclusion size descritor for animated meshes, to prevent them from being hidden when their logical center is located offscreen and their vertices are still onscreen. Often seen with characters that are lieing dead on the floor.


Naughty Alien(Posted 2006) [#14]
Hey JFK, I cant find CULLBOX command in my Blitz3D command reference..can you update me whats that command and syntax??


b32(Posted 2006) [#15]
I believe it's MeshCullBox mesh, x#, y#, z#, width#, height#, depth#


Naughty Alien(Posted 2006) [#16]
..I cant see MeshCullBox commant within my Blitz3D command reference too..am i missing some B3D help docs update??


jfk EO-11110(Posted 2006) [#17]
MeshCullBox was added in release, 1.97. If you cannot find something in the reference, you may read the version.txt, that is located inside your Blitz3D installation folder. It contains notes about the version releases by Mr. Sibly, including a quick description of the new commands.

Additionally, the Online Manual now allows to search for substrings, so in this case you could enter "cull". Also try things like "pick", "cam" etc to get "command family" lists.

Although, it seems MeshCullBox was not added yet. The Manuals are updated frequently, but not with every Compiler Update.