Jump to content

Recommended Posts

Posted

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/

Posted

 

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/

Posted

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

Let's build cool stuff and have fun. :)

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.

×
×
  • Create New...