Jump to content

Programming an elevator.


smashthewindow
 Share

Recommended Posts

Check out the link I posted above. (Sorry, I think forum upgraded to only allow videos in the "Videos" section.)

Right now, I'm using the code below to move the floor(Which is nothing but a small box made in Blender):

 

[/size]
[size=4]LE::TVec3 vel = LE::CalcBodyVelocity( platform, destination ) / timeInterval;[/size]
[size=4]LE::SetBodyVelocity( moveTarget, vel );[/size]
[size=4]LE::TVec3 omega = LE::CalcBodyOmega( platform, LE::Vec3(0) ) * 100.0f;[/size]
[size=4]LE::SetBodyOmega( platform, omega );[/size][size=4]

 

As you see in the video, the character just slides off the moving floor (even on ridiculous high frictions.).

 

Can I get some advice on how someone would create an elevator?

 

I've been able to get past this for Round & Round by just making the elevator part a cutscene when the ball gets on it, but I won't be able to do the same for a game I'm prototyping.

 

Thanks for reading.

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

I made a moving platform before. I believe what I did was use a body just for calling MoveEntity() on. Then I made a joint between the this body and the model that is the elevator. MoveEntity() will kill physics but because it's on the body it didn't matter because the player stands on the model, but because there is a joint the model will move (with physics) with the body.

 

The nice thing about this is you can be very precise in movement because you are avoiding forces and can use functions like PositionEntity() or MoveEntity().

Link to comment
Share on other sites

I made a moving platform before. I believe what I did was use a body just for calling MoveEntity() on. Then I made a joint between the this body and the model that is the elevator. MoveEntity() will kill physics but because it's on the body it didn't matter because the player stands on the model, but because there is a joint the model will move (with physics) with the body.

 

The nice thing about this is you can be very precise in movement because you are avoiding forces and can use functions like PositionEntity() or MoveEntity().

 

Wouldn't the joint limit player movement on the elevator?

 

EDIT: I misread your post. Understood. Thanks biggrin.png

 

EDIT2: But the thing with that is that you wouldn't be able to move while on the elevator right?

 

Nevermind, you're a genius.

 

EDIT3: Will the player still be intact even when the elevator moves sideways like I'm doing in the video?

Blog & Portfolio

 

Current project: moon.chase.star

Link to comment
Share on other sites

Not a genius, just handing off information that was once told to me smile.png . I believe Josh or someone else provided me with this information years back but I remember it working and loving it because it gave great control to moving platforms. Hope it works out for you!

 

Note that it acts like in real life. If your platform is moving really fast then suddenly stops your player will keep moving in that direction so either keep things slow, or slow down before stopping if you're going fast.

  • Upvote 1
Link to comment
Share on other sites

There is code in the engine that specifically handles the case you are showing and adds velocity to the character. Not sure why it's not working in your video.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I once did an elevator which moved up inside an elevator shaft using moveentity and nothing else.The character ( first person) moved up with it but I never figured how to make it stop in exactly the right place so the doors could open and the character step out.

 

Does not matter now as I am doing a medieval game.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...