Door Resource Version 1.0
by Tom Feni · 04/14/2006 (9:32 am) · 43 comments
Door resource version 1.0
scripts written by : Ramen Sama
dts shapes/difs created by TomFeni
textures from varios sources, ie golgatha pack.
* no engine changes required
File - Door Resource
There are various door types and movement for two types, up and side movement.
the door that slides will move in the direction of the hinges.
the up and down doors will be created in the proper direction.
add scripts and other files in apropiate folders or just drop the data and server folder in the starter.fps folder and it should place them in the right spots.
doors can be scaled to whatever you need and still work.
I will include the milkshape files for those with milkshape.
// creating doors for use in scripts //
* make your door (can be various shapes or sizes)
* texture the shape
* create 2 joints one as the base and one as the slider, assign the door to the slider joint( I named mine "open" for easy use:)
* create your animation. I used 1-30 and created first key at 1 and second key at 30
* now create a duplicate of your door( best for doors of basic shape, since I could only get one collision to work. Maybe someone else could figure out how Ramen did the doors, I couldnt ), name this as collision-1.
now your collision should move with the door in animation mode.
if your using the dts plus then create a new animation in the export screen and name it "open" to coincide with the script( you can name it whatever you wish but be sure to change it in script also ).
in game.cs add
exec("./doors/door.cs");
exec("./doors/doorMetal.cs");
exec("./doors/doorgrey1.cs");
exec("./doors/doorWood.cs");
exec("./doors/doorMetalMove.cs");
now fix the script and go in game. When you run up to the door it should open on collision.
Issues I have seen :
- only able to have one collision
- thrown objects will open the door.. :)
- rotating doors will pass thru the player model when opened.
I hope this is useful for others as it was for me.
most of the credit goes to Ramen for figuring out the code part and how to get dts shapes to work with out engine changes.. :)
TomFeni
scripts written by : Ramen Sama
dts shapes/difs created by TomFeni
textures from varios sources, ie golgatha pack.
* no engine changes required
File - Door Resource
There are various door types and movement for two types, up and side movement.
the door that slides will move in the direction of the hinges.
the up and down doors will be created in the proper direction.
add scripts and other files in apropiate folders or just drop the data and server folder in the starter.fps folder and it should place them in the right spots.
doors can be scaled to whatever you need and still work.
I will include the milkshape files for those with milkshape.
// creating doors for use in scripts //
* make your door (can be various shapes or sizes)
* texture the shape
* create 2 joints one as the base and one as the slider, assign the door to the slider joint( I named mine "open" for easy use:)
* create your animation. I used 1-30 and created first key at 1 and second key at 30
* now create a duplicate of your door( best for doors of basic shape, since I could only get one collision to work. Maybe someone else could figure out how Ramen did the doors, I couldnt ), name this as collision-1.
now your collision should move with the door in animation mode.
if your using the dts plus then create a new animation in the export screen and name it "open" to coincide with the script( you can name it whatever you wish but be sure to change it in script also ).
in game.cs add
exec("./doors/door.cs");
exec("./doors/doorMetal.cs");
exec("./doors/doorgrey1.cs");
exec("./doors/doorWood.cs");
exec("./doors/doorMetalMove.cs");
now fix the script and go in game. When you run up to the door it should open on collision.
Issues I have seen :
- only able to have one collision
- thrown objects will open the door.. :)
- rotating doors will pass thru the player model when opened.
I hope this is useful for others as it was for me.
most of the credit goes to Ramen for figuring out the code part and how to get dts shapes to work with out engine changes.. :)
TomFeni
About the author
#2
Nice animation, and collision as the door opens. I use Blender, so there is no multiple collision meshes, or animated ones for that matter.
04/14/2006 (10:28 am)
Hmm... what i do is the door implementation from Advanced 3DGPAIO, but since the animation looks skippy i only use that for an invisible "collision door". I then create a nicely animated door that i put on top of it in game world. Nice animation, and collision as the door opens. I use Blender, so there is no multiple collision meshes, or animated ones for that matter.
#3
but I am glad that it works so good.. most of the others are hard to implement or not working anymore..
04/14/2006 (4:37 pm)
well with milkshape uit wont let me.. so must be something with milkshape.. or maybe since I didnt add it to the animation.. hmm.. not sure.. I will fiddle with it and see whats what.. :)but I am glad that it works so good.. most of the others are hard to implement or not working anymore..
#4
04/15/2006 (3:20 pm)
hey guys, does either this resource or the one Ramen made create doors that rotate on a hinge like a regular door?
#5
but you will have to make it rotate in milkshape or whatever you use..
only drawback is the dts will not collide with your player. so it will pass thru you..
but then I think you could use a ray cast to see if your in the way and push you back form the door that way..
04/15/2006 (6:36 pm)
yesbut you will have to make it rotate in milkshape or whatever you use..
only drawback is the dts will not collide with your player. so it will pass thru you..
but then I think you could use a ray cast to see if your in the way and push you back form the door that way..
#6
So, if I understand correctly, and please correct me if I am wrong, you can get a moving collision shape for the sliding door, but not for the rotating door?
If that is correct, why not make a sliding door collision that operates with a rotating door object, but is large enough to cover the arc of rotation for the door?
I will take a detailed look at the resource as soon as I get a chance.
04/15/2006 (11:32 pm)
Tom, thanks for the response.So, if I understand correctly, and please correct me if I am wrong, you can get a moving collision shape for the sliding door, but not for the rotating door?
If that is correct, why not make a sliding door collision that operates with a rotating door object, but is large enough to cover the arc of rotation for the door?
I will take a detailed look at the resource as soon as I get a chance.
#7
but with the rotating door it doesnt want to collide, so you will either have to live with that or make some engine changes..
04/16/2006 (6:37 am)
no the door has a collision whther its rotating or notthe collision rotates but the collision does not get sent to the player. its always been that way..the collision is what tells the animation to work.. so when you touch the door your touching the collision, then everything moves out of the way.but with the rotating door it doesnt want to collide, so you will either have to live with that or make some engine changes..
#8
this has the milkshape file, texture and dts..
should give you an idea how to set it up.. :)
it only hits the player if its opening towards him so if you made the trigger one way then it would never open into the player, or use the raycast to check if he is in the way and not open..
04/16/2006 (6:51 am)
Rotating door this has the milkshape file, texture and dts..
should give you an idea how to set it up.. :)
it only hits the player if its opening towards him so if you made the trigger one way then it would never open into the player, or use the raycast to check if he is in the way and not open..
#9
04/16/2006 (7:53 am)
Cool Tom, haven't tried it but we've needed a new Door resource for a long time !
#10
04/16/2006 (9:19 am)
Tom, thanks very much.
#11
04/20/2006 (12:55 pm)
nice resource....But i create a door with your caratteristic in milk shape but don't move?!?!!? Help step by step please =D
#12
now you can seperate the box into front/back/left/right/top/bottom faces and the texture door all pretty like..
now make a joint at the bottom of the door ( I put it next to the side I want to move like say the left side for it to move left ) then with the joint highlighted make a second one right above it.. now the first joint name it "base" second joint name it "open"
now high light the open joint, switch over to groups, highlight all your faces for the doors by selecting the groups, not by selecting in the window. now switch back to your joints window and assign these faces to teh open joint.
now in animation mode when you move the open joint the whole door should move too. now create a animation scale 30 units. leave the door at the default setting(closed) and assign that as your first animation point. move the slider all the way over to the right to 30 then open your door to where you want it.. I left it sticking out a bit so you still see it. now save that animation key now when your un the animation it should show the door sliding..
now go out of animation mode and select all your groups, create a duplicate and name this collision-1
now go back in animation mode, you should see the door and collision both slide together.
now on export add a animation with the name "open" with a scale of 1-30
thats about it.. you can swap out the sounds too and rename them in script if you wish..
the doors are basic but with effort I am sure people can make some awesome stuff
:)
TomFeni
04/20/2006 (3:29 pm)
Ok in milkshape make a box shape door.now you can seperate the box into front/back/left/right/top/bottom faces and the texture door all pretty like..
now make a joint at the bottom of the door ( I put it next to the side I want to move like say the left side for it to move left ) then with the joint highlighted make a second one right above it.. now the first joint name it "base" second joint name it "open"
now high light the open joint, switch over to groups, highlight all your faces for the doors by selecting the groups, not by selecting in the window. now switch back to your joints window and assign these faces to teh open joint.
now in animation mode when you move the open joint the whole door should move too. now create a animation scale 30 units. leave the door at the default setting(closed) and assign that as your first animation point. move the slider all the way over to the right to 30 then open your door to where you want it.. I left it sticking out a bit so you still see it. now save that animation key now when your un the animation it should show the door sliding..
now go out of animation mode and select all your groups, create a duplicate and name this collision-1
now go back in animation mode, you should see the door and collision both slide together.
now on export add a animation with the name "open" with a scale of 1-30
thats about it.. you can swap out the sounds too and rename them in script if you wish..
the doors are basic but with effort I am sure people can make some awesome stuff
:)
TomFeni
#13
04/21/2006 (12:15 am)
Nice nice nice =D it's all ok =) THANKS
#14
04/21/2006 (10:40 am)
@Tom- I recreated your door setup in Max5 and while in-game the open animation works the collision box is not moving out of the way, keeping me from entering the room behind it. Can you suggest something I should look to move the collision box?
#15
ie add the collision under the shape in the hierachy tree..
maybe the 3ds amx users can figure something out.. :)
and add it here so others can find it.. :)
04/21/2006 (12:39 pm)
well havent done it in 3ds max so not sure how it should be done. maybe tie the collision to the shape as a child object and not as a seperate entity?ie add the collision under the shape in the hierachy tree..
maybe the 3ds amx users can figure something out.. :)
and add it here so others can find it.. :)
#16
04/21/2006 (12:44 pm)
Sure, if I get it working I'll add to your post.
#17
I am sure it should be possible.. but as I said I dont have 3ds max..
hope you get a working solution tho.. its a pretty good door resource.. (thanks ramen) :)
04/21/2006 (1:52 pm)
ok, just wanted to have it here as we know it works in milkshape and in lightwave, so if we can geta working example for 3dsmax then we have pretty much everyone covered.. :)I am sure it should be possible.. but as I said I dont have 3ds max..
hope you get a working solution tho.. its a pretty good door resource.. (thanks ramen) :)
#18
I think that should work
04/22/2006 (7:28 pm)
if you wanted only players to open it you modify the following function//Called when you touch the door
function doorMetalMove::onCollision(%this,%door,%col){
if (!%door.open&&%col.getClassName() $= "Player"){//make sure we're a player
%door.open=true;
%door.setthreaddir(0,"true");
%door.playthread(0,"open");
serverPlay3D(doorMetalOpenSound,%col.getTransform());
%this.schedule(2000, close, %door,%col);
}
}I think that should work
#19
04/22/2006 (10:24 pm)
Thanks Master Treb. I'll test your code this week and post the results.
#20
04/29/2006 (11:07 am)
Saddly, this code change didn't work for me. And while the collision box still does not move when it should I've noticed a violent repulsion of the vehicle model from the door when I collide with it. If I collide with the door even at a slow speed the vehicle model is literally thrown from that spot several hundred feet across the terrain. 
Torque Owner Cinder Games