Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  ObiRope Points
#33
(22-10-2021, 08:30 AM)josemendez Wrote: That's precisely what I've been telling you not to do all the while!  Guiño

Physical objects (both in the real world and game engines) interact trough forces.
A force is basically a mass-weighted acceleration, that is: a change in the object's velocity, dependant on its mass. In Unity, you turn an object into a physical object (with velocity and mass) by adding a rigidbody component.

A transform has no velocity. It is just a position (& rotation & size) in space. So when you do:

object.transform.position = newPosition;

All you're doing is teleporting the object to a new place *instantly*. It will ignore forces of any kind, or any physical objects interacting with it, including ropes.


In Unity, if you directly set the transform of a rigidbody, you will see it does not change its speed and it does not interact with objects around it: it's perfectly possible to simply make a cube teleport to the other side of a solid wall by setting its transform position. Setting the position of the cube will ignore all objects around the cube or any external forces opposing movement.

In this case, you want the cube to be affected by the forces applied by the rope: if the rope is completely tense, you want it to be difficult to move the cube. If the rope is loose, the cube should be easy to move. So you need two forces to act on the cube: one applied by the rope, and one applied by the user. When the rope is not tense, it applies a very small force to the cube: the force applied by the user is larger and allows the cube to move. When the rope is very tense, the force applied by the rope is large and it cancels out the force applied by the user, so the cube does not move any further.

This is just basic physics, not Obi-specific. It's what happens in the real world, and what all engines (Unity, Obi, Havok, etc) simulate. You would need to do the same if your rope was made using any other engine, for instance a chain of Unity rigidbodies.
Let's say I want to move my fork to a higher position, now I am doing it like this. How am I supposed to do this using physics?

_plugObject.transform.position = new Vector3(_plugObjectPos.x, _plugObjectPos.y + 0.5f, _plugObjectPos.z);

or

_currentPosition = GetMousePosition();
var deltaX = _currentPosition.x - _prevPosition.x;
_plugObject.transform.position = new Vector3(_plugObject.transform.position.x + deltaX, _plugObject.transform.position.y, _plugObject.transform.position.z);
Reply


Messages In This Thread
ObiRope Points - by Matbee - 19-10-2021, 10:26 AM
RE: ObiRope Points - by josemendez - 19-10-2021, 10:50 AM
RE: ObiRope Points - by Matbee - 19-10-2021, 11:24 AM
RE: ObiRope Points - by josemendez - 19-10-2021, 11:27 AM
RE: ObiRope Points - by Matbee - 19-10-2021, 11:00 AM
RE: ObiRope Points - by josemendez - 19-10-2021, 11:24 AM
RE: ObiRope Points - by Matbee - 19-10-2021, 11:28 AM
RE: ObiRope Points - by josemendez - 19-10-2021, 11:29 AM
RE: ObiRope Points - by Matbee - 19-10-2021, 11:47 AM
RE: ObiRope Points - by josemendez - 19-10-2021, 12:02 PM
RE: ObiRope Points - by Matbee - 19-10-2021, 01:26 PM
RE: ObiRope Points - by josemendez - 19-10-2021, 01:30 PM
RE: ObiRope Points - by Matbee - 19-10-2021, 02:36 PM
RE: ObiRope Points - by josemendez - 19-10-2021, 02:50 PM
RE: ObiRope Points - by Matbee - 19-10-2021, 02:52 PM
RE: ObiRope Points - by josemendez - 19-10-2021, 03:02 PM
RE: ObiRope Points - by Matbee - 19-10-2021, 04:23 PM
RE: ObiRope Points - by josemendez - 19-10-2021, 04:36 PM
RE: ObiRope Points - by Matbee - 20-10-2021, 09:23 AM
RE: ObiRope Points - by josemendez - 20-10-2021, 09:53 AM
RE: ObiRope Points - by Matbee - 20-10-2021, 02:12 PM
RE: ObiRope Points - by josemendez - 20-10-2021, 02:30 PM
RE: ObiRope Points - by Matbee - 20-10-2021, 04:06 PM
RE: ObiRope Points - by josemendez - 20-10-2021, 05:41 PM
RE: ObiRope Points - by Matbee - 21-10-2021, 10:14 PM
RE: ObiRope Points - by josemendez - 21-10-2021, 10:26 PM
RE: ObiRope Points - by Matbee - 21-10-2021, 10:42 PM
RE: ObiRope Points - by josemendez - 22-10-2021, 07:18 AM
RE: ObiRope Points - by Matbee - 22-10-2021, 07:56 AM
RE: ObiRope Points - by josemendez - 22-10-2021, 08:04 AM
RE: ObiRope Points - by Matbee - 22-10-2021, 08:20 AM
RE: ObiRope Points - by josemendez - 22-10-2021, 08:30 AM
RE: ObiRope Points - by Matbee - 22-10-2021, 08:41 AM
RE: ObiRope Points - by josemendez - 22-10-2021, 08:46 AM
RE: ObiRope Points - by Matbee - 22-10-2021, 12:40 PM
RE: ObiRope Points - by josemendez - 25-10-2021, 08:44 AM
RE: ObiRope Points - by josemendez - 22-10-2021, 08:46 AM