Jump to content

Constraint platform axis


DooMAGE
 Share

Recommended Posts

Hello friends,

 

I'm doing some tests for the summer contest. :)

 

In my game I have a platform that moves foward indefinitely, the problem is that when the player is on the platform the platform over time starts moving to other directions, I guess it's because the physics and the player mass above the platform.

 

How I can constraint the movement of the platform to always be locked to one axis?

 

I'm using this:

 

function Script:UpdatePhysics()
self.entity:SetVelocity(0,0,2, true)
end

My Leadwerks games!

https://ragingmages.itch.io/

Link to comment
Share on other sites

 

Not yet, maybe this can be used to a 3D game too?

 

I think I fixed the problem, but I don't know why or how it works. I used something called Joint::Slider

 

function Script:Start()
 self.entity:SetCollisionType(Collision.Scene)
 local position=self.entity:GetPosition(true)
 self.joint=Joint:Slider(position.x,position.y,position.z,0,0,0,self.entity,nil)
end

function Script:UpdatePhysics()
 self.entity:SetVelocity(0,0,2, true)
end

My Leadwerks games!

https://ragingmages.itch.io/

Link to comment
Share on other sites

The limits will keep it from moving beyond a certain range, if that is what you want.

 

You can also use the motor feature to move the joint.

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