Setting LinearFactor and AngularFactor

Just starting out? Need help? Post your questions and find answers here.
neseir
User
User
Posts: 10
Joined: Fri Jun 11, 2010 10:48 am

Setting LinearFactor and AngularFactor

Post 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
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Setting LinearFactor and AngularFactor

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Setting LinearFactor and AngularFactor

Post 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 ?
Please correct my english
http://purebasic.developpez.com/
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Setting LinearFactor and AngularFactor

Post 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.
bye,
Daniel
neseir
User
User
Posts: 10
Joined: Fri Jun 11, 2010 10:48 am

Re: Setting LinearFactor and AngularFactor

Post 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
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Setting LinearFactor and AngularFactor

Post 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.
bye,
Daniel
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Re: Setting LinearFactor and AngularFactor

Post 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.
Please correct my english
http://purebasic.developpez.com/
neseir
User
User
Posts: 10
Joined: Fri Jun 11, 2010 10:48 am

Re: Setting LinearFactor and AngularFactor

Post by neseir »

Great !

Are we talking 4.61/4.62 or 4.7 :D ?

//Eirik
Post Reply