Jump to content

Moving Platforms


tjheldna
 Share

Recommended Posts

Im trying to create a moving platform between two points and need the player move with the platform.

 

This interpolates the platform between the points nicely

 

Vec3 lastPosition;

 

lastPosition.x = Math::Lerp(current->GetPosition().x, finish->GetPosition().x, smoothness / Time::GetSpeed());

lastPosition.y = Math::Lerp(current->GetPosition().y, finish->GetPosition().y, smoothness / Time::GetSpeed());

lastPosition.z = Math::Lerp(current->GetPosition().z, finish->GetPosition().z, smoothness / Time::GetSpeed());

 

current->SetPosition(lastPosition.x, lastPosition.y, lastPosition.z);

 

Currently Iv'e created a platform which sinks into the ground however when the character controller jumps on it, he does not sink with the platform until I move him, so maybe the physics on the character is sleeping or something. Also he does not move with the platform as it moves from side to side.

 

Am I doing something wrong in the way I have created this 'Mover Object'? Am I supposed to use a Slider Joint? Not too sure.

 

Thanks all!

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

Are you using LE's physics for this? If so don't you have to use the physics set position on the platform? http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entityphysicssetposition-r190

 

As I recall, setting the position like you are, on a physics shape, disabled it's physics.

 

Also have a look at http://www.leadwerks.com/werkspace/files/file/434-elevator/

  • Upvote 1
Link to comment
Share on other sites

I use a motorized slider joint for moving platforms. (You can release the joint and create a new one when the waypoints change.) One of the tutorials in 3.1 is on this, actually.

  • Upvote 1

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

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...