(Solved)ConstantForce Probelms
I am using unity 3d and trying to have platforms move, but every time I try to get them to work they keep attaching to each other, which makes them move with both ConstantForce powers added. I've tried to keep them from attaching but I couldn't, so is there any way for them not to use both constant forces and/or just move as 1 solid piece?
Answer by streeetwalker · Mar 24, 2020 at 05:26 PM
@wail13 , it's hard to imagine gameobjects "attaching to each other" - your phrasing could be interpreted in different ways.
If you apply the same force in the same direction to two objects, they will move in the same direction at the same rate, and if they are not already touching they will not appear to "attach to each other", unless you have other forces acting on them that somehow bring them together. But even then, they are not "attached."
If you create a parent object and make your two platforms children of that, you can apply the force to the parent.
@streeetwalker, so the platforms actually "spawn" in and start moving but when they spawn in they overlap each other which makes them move twice as fast, is there any way to stop that? thank you
@wail13, I don't know - it's weird behavior.
It could be that because Rigidbodies act on each other, when you spawn them overlapping and applying a force, they don't have a chance to move away from each other - normally a collision would be generated and they would bump off in other directions. And if a body has a force applied and hits another body, it's going to push the other. So, the theory would go, if they are already overlapping, maybe the force gets added or multiplied together. I've never heard of it because in normal use, we don't spawn rigidbodies in overlapping positions.
It sounds like you working in 2D - if so, you could offset their z positions so that they are not actually touching in space.
If that doesn't work, have you tried turning off the constant force on one?
Otherwise, you'll need to either create one object out of them, or parent them a third object that also has a rigid body and apply the constant force to the parent.
@streeetwalker That sounds right(about the rigidbodies acting on each other) but I am working in 3d, would there be another way to get the rigidbodies not to be able to touch. and I've been a little unclear sorry the GameObjects are actually spawning in every 11 seconds and moving towards the camera but when they spawn they always overlap which makes them move at a higher speed because the rigidbodies are all using constant force.
Your answer
Follow this Question
Related Questions
How do I make a rocket? 2 Answers
Multiplayer First Person Game 0 Answers
Item is only picked up when it is moving 0 Answers
Ball won't stop bouncing 1 Answer