Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow changing velocity scaling factor on each axis individually #15

Open
LeXXik opened this issue Mar 2, 2021 · 3 comments
Open

Allow changing velocity scaling factor on each axis individually #15

LeXXik opened this issue Mar 2, 2021 · 3 comments

Comments

@LeXXik
Copy link

LeXXik commented Mar 2, 2021

A feature request to add linear and angular velocity scaling factor on a rigidbody, which would allow to control each axis individually:

For example, in Bullet engine:

void btRigidBody::setLinearFactor(const btVector3 &linearFactor);
void btRigidBody::setAngularFactor(const btVector3 &angFac);
@sebcrozet
Copy link
Member

Thank you for this feature suggestion. What are some concrete use-case for these factors?

If you are looking for the ability to lock the rotation and/or translation movements of a rigid-body, you can already use RigidBodyDesc.restrictRotations, RigidBodyDesc.lockRotations, and RigidBodyDesc.lockTranslations.

@LeXXik
Copy link
Author

LeXXik commented Mar 2, 2021

@sebcrozet to be honest, I don't have many examples, when I would use it other than just to lock some axis. I think the only time I used it with interpolation between 0 and 1 was when there was a game with wind gusts, where a wind would suddenly "blow" from some direction at varied strength, dampening the player controller movement at some direction. I guess the same could be achieved by applying a force on the controller.

I stumbled upon this while integrating Rapier with PlayCanvas, which currently is integrated with Ammo. The Editor exposes those properties:
image

Setting one of them to 0 would effectively "lock" the axis, which is a way to do it in Ammo. Not too critical of a feature, I suppose, as I can probably output a message to user that only 0 or 1 is supported when using Rapier backend.

@LeXXik
Copy link
Author

LeXXik commented Apr 23, 2021

In a casual game of bowling, I have some hazards on the road that imped the ball's travel. For example, water or sand, which affect the ball's movement in a single or both axii. The way it works is that the ball multiplies own factors with whatever it traverses through. I think it would be a good case for enabling linear/angular factors here. For now, I have to code in the factors separately for each type, verify the obstacle type the ball is going through and manually adjust the velocity based on the factors multiplication result.

Edit:
Actually, thinking about it, this is not how the linear factor should be used. I mean it can, but then it is a decision of mine, rather than the physics engine. One's linear factor should not affect the other one's. It's probably related to the friction factors rather, but I think we can't change friction on each axis individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants