22-10-2021, 08:46 AM
(This post was last modified: 22-10-2021, 08:59 AM by josemendez.)
(22-10-2021, 08:41 AM)Matbee Wrote: 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);
Using rigidbody.AddForce. See:
https://docs.unity3d.com/ScriptReference...Force.html
Edit: this tutorial will be useful to you: it's for 2D rigidbodies, but the same applies to 3D:
https://www.studytonight.com/game-develo...ay-to-move
I'd recommend reading up on physics and how to move objects in Unity. Obi is a quite advanced engine, it will be very confusing and difficult to use if you're not familiar with the basics first.