I would like to move an object forever at a specific speed. But I also would like to use physics, because the object need to move in to different angle and bounce if it collide with something, but never slow down. keep a minimum speed.
I know it unrealistic regarding physics, but this is what I need.
The problem is that, if I use the physics automatism, the object is slow down after a while whatever gravity, weight or elasticity I use.
The object is slow down and stop. So, the physics engine is works but I would like to cheat. All I need from the physics engine basically is to bounce the object and calculate the new angle of movement after every collision but don’t effect the speed of the object.
Is there a way I can go around with this without need to set manually the angle of movement and speed after every collision?
For example in Construct 2, I can choose if I want an object to always move at certain speed, and to bounce back from solid objects.
This is what I need in GameDevelop too.
Any suggestions would be great.
Here is a little example :
InfiniteMove.rar (5.75 KB)
How you can see, you have to set the Physic Automatism for the bouncing object and the “walls”:
Friction = 0
Restitution (Elasticity) = 1
Angular Damping = 0
Linear Famping = 0
You are a genius
I was forgot about damping completely. I didn’t even noticed it set to 0.1 by default, for some reason I thought it 0
I can’t be thankful enough for your ongoing help.
Thanks a lot.
I’ve noticed that (maybe) some settings are unnecessary:
Apparently, “Angular Damping” doesn’t affects the movement (I guess it only affects rotations)
Seems like “Friction” needs to be = 0 in one object only (probably frictions are multiplied)
I don’t know why, but the pea doesn’t rotate
True. Only the Linear Damping effects the movement speed.
The rotation is strange. If I use the event to let pea rotate freely, nothing happen, pea don’t rotate but I would expect it rotate “freely”.
If I specify the torque speed, pea is rotating but only in to one direction which I don’t feel realistic, so I thought I’ll store the torque speed in a variable and I’m going to calculate some kind of random rotation (random negative, positive value) on every collision. But the Random() function can use only whole numbers, even 1 is too fast rotation for me, so I would use as low numbers like 0.2, 0.3 but it not possible Random() cannot work with them.
I have found a way to rotate, crappy but better then nothing
In any condition : pea torque = pea.Variable(rotation)
pea is in collision with wall : pea.Variable(number) = Random(1)
pea.Variable(number) = 0 : pea.Variable(rotation) = -0.1
pea.Variable(number) = 1 : pea.Variable(rotation) = 0.1
For less code you could try this:
pea.Variable(rotation) = (Random(2) - 1)/10
This always return -0.1 >= value <= 0.1