Hello. I modified Basic Example to represent a problem. I have an Object. It's a cylinder shape btRigidBody with the mass = 1.0, linear factor is set to block vertical movement, gravity is set to zero vector. Also there are 4 walls. Walls are static collisions (mass = 0, btRigidBodies too). There is no ground.
I want to set some velocity to the Object and keep this velocity until I want to stop the object. To achieve this, I set all restitutions to 1.0 and frictions of both walls and Object to 0.0. But seems, that linear velocity become less after collision with walls.
So, I want to set speed and then my Object will fly infinitely bouncing walls without velocity loss. How to achieve it in the correct way?
Here is simple video describing the problem. In logging window there are Linear Velocity vector and its magnitutde logged
https://youtu.be/NkpB1r8ugmY
Absolute elastic collisions
-
- Posts: 2
- Joined: Thu Aug 02, 2018 3:30 pm
Absolute elastic collisions
Last edited by b2soft on Fri Aug 03, 2018 8:41 am, edited 2 times in total.
-
- Posts: 849
- Joined: Tue Sep 30, 2014 6:03 pm
- Location: San Francisco
Re: Absolute elastic collisions
You want restitution to be 1.0 all around. A restitution of 1.0 means maximum elasticity. Also, set friction to be 0.0 all around.
-
- Posts: 2
- Joined: Thu Aug 02, 2018 3:30 pm
Re: Absolute elastic collisions
Sorry, I edited my post.
Sure, I set frictions to 0, restitutions to 1
Here is the code I used to record a video: https://codeshare.io/5OZzJW
I'm using Basic Example from the latest Bullet repo
Sure, I set frictions to 0, restitutions to 1
Here is the code I used to record a video: https://codeshare.io/5OZzJW
I'm using Basic Example from the latest Bullet repo
-
- Posts: 849
- Joined: Tue Sep 30, 2014 6:03 pm
- Location: San Francisco
Re: Absolute elastic collisions
The link to your code returns 502 for me.
If you've set the mass and material properties right then I dunno why you would lose velocity on collision. How much relative energy was lost? Did you happen to check the angular velocity after the collision to see if linear energy was being converted to spin?
Why do you want to conserve energy after many collisions? Are you trying to simulate real physics or are you trying to make a fun game?
If you've set the mass and material properties right then I dunno why you would lose velocity on collision. How much relative energy was lost? Did you happen to check the angular velocity after the collision to see if linear energy was being converted to spin?
Why do you want to conserve energy after many collisions? Are you trying to simulate real physics or are you trying to make a fun game?