How to set the axis of btSliderConstraint?

allenshen
Posts: 6
Joined: Mon Jan 28, 2013 2:51 am

How to set the axis of btSliderConstraint?

Post by allenshen »

Hi,everyone,it seems the default axis of btSliderConstraint is 'X',how can I set the axis along the arbitrary vector?thx!
User avatar
SynapticBytes
Posts: 74
Joined: Thu Feb 10, 2011 8:27 pm

Re: How to set the axis of btSliderConstraint?

Post by SynapticBytes »

When setting up the slider, you pass in a tranform which contains the translation axis. So just set your axis vector in that transform.
allenshen
Posts: 6
Joined: Mon Jan 28, 2013 2:51 am

Re: How to set the axis of btSliderConstraint?

Post by allenshen »

SynapticBytes wrote:When setting up the slider, you pass in a tranform which contains the translation axis. So just set your axis vector in that transform.
Thanks!But how to set my axis vector in the transform?
User avatar
SynapticBytes
Posts: 74
Joined: Thu Feb 10, 2011 8:27 pm

Re: How to set the axis of btSliderConstraint?

Post by SynapticBytes »

Something like this

Code: Select all

btTransform tr = new btTransform;
tr.setIdentity();
tr.setOrigin(btVector3(0,1,0)); // whatever vector values you want for your translation axis