Page 1 of 1

Setting LinearFactor and AngularFactor

Posted: Tue Jan 17, 2012 11:27 am
by neseir
Hi

In bullet physics it is possible to set the LinearFactor and the AgularFactor on a physics object to restrict the action to e.g. just move in the x, y plane and rotate around the z-axis (like Box2D).

Have looked through the 3D commands but I can not find these functions published (or refered to in the documentation).

in C++ it would be

Code: Select all

body->setLinearFactor(btVector3(1,0,1));
body->setAngularFactor(btVector3(0,1,0));
Is this implemented ? If yes, how can it be set in purebasic ?

Regards
Eirik

Re: Setting LinearFactor and AngularFactor

Posted: Tue Jan 17, 2012 5:44 pm
by IdeasVacuum
....This is a game programing question really - While waiting for a reply from one of the forum experts on the subject, have a look at/search the game programing section, particularly the game math post.

Re: Setting LinearFactor and AngularFactor

Posted: Tue Jan 17, 2012 7:14 pm
by Comtois
just move in the x, y plane and rotate around the z-axis (like Box2D)

Code: Select all

body->setLinearFactor(btVector3(1,0,1));
body->setAngularFactor(btVector3(0,1,0));
.
While waiting for 4.70 version (i dont know if this will be added, wait and see)...

You can move in the x, z plane and rotate around the y-axis using EntityMove() and RotateEntity(). See ThirdPerson.pb example, or CameraTrack.pb.
Is it what you are looking for ?

Re: Setting LinearFactor and AngularFactor

Posted: Tue Jan 17, 2012 7:57 pm
by DarkDragon
Comtois wrote:
just move in the x, y plane and rotate around the z-axis (like Box2D)

Code: Select all

body->setLinearFactor(btVector3(1,0,1));
body->setAngularFactor(btVector3(0,1,0));
.
While waiting for 4.70 version (i dont know if this will be added, wait and see)...

You can move in the x, z plane and rotate around the y-axis using EntityMove() and RotateEntity(). See ThirdPerson.pb example, or CameraTrack.pb.
Is it what you are looking for ?
No, he wants something to prevent an object to be moved by the physics in a unusual way. E.g. inside a jump'n'run you shouldn't move the objects in the depth, just in the height and width. Or you shouldn't shoot a billard ball out of the table. I requested something similar already: http://www.purebasic.fr/english/viewtop ... =3&t=47507

In my jump n run the player is rotating around when walking or crashing into something.

His idea is probably the best: apply a factor for all physics of an object.

Re: Setting LinearFactor and AngularFactor

Posted: Wed Jan 18, 2012 1:04 am
by neseir
Hi DarkDragon

You are spot on the usage. If the bullet edition used inside purebasic is later than 2.75 then this functions are already implemented :

http://bulletphysics.org/mediawiki-1.5. ... e_Snippets

The only part I could not see was if the methods where published for the entity in PureBasic command set (or as a flag/parameter etc). All of course depending on the release of the Bullet Engine used.

BR
Eirik

Re: Setting LinearFactor and AngularFactor

Posted: Wed Jan 18, 2012 8:24 am
by DarkDragon
neseir wrote:The only part I could not see was if the methods where published for the entity in PureBasic command set (or as a flag/parameter etc). All of course depending on the release of the Bullet Engine used.
No they aren't inside the PureBasic command set. Thanks for the hint that there are already functions for it, I will update my feature request for purebasic.

Re: Setting LinearFactor and AngularFactor

Posted: Wed Jan 18, 2012 8:37 pm
by Comtois
Ok i see, good suggestion, we will look at it. And before you ask, yes I help Fred and G-Rom on the 3D lib.

Re: Setting LinearFactor and AngularFactor

Posted: Thu Jan 19, 2012 10:59 pm
by neseir
Great !

Are we talking 4.61/4.62 or 4.7 :D ?

//Eirik