Morning everyone!
I’m making a game here about working in a store. One of the features I’m trying to put together right now is the ability to move pallets of goods with a hand jack (It’s like a forklift except its manual powered and doesn’t lift vertically more than a foot or so). Currently while testing I just used
if (Input.GetButton("Fire1")) {
transform.position = new Vector3 (transform.position.x, transform.position.y + .01f, transform.position.z);
} else if (Input.GetButton("Fire2")) {
transform.position = new Vector3 (transform.position.x, transform.position.y - .01f, transform.position.z);
}
if (Input.GetKey(KeyCode.T)) {
transform.position = new Vector3 (transform.position.x, transform.position.y, transform.position.z + .01f);
} else if (Input.GetKey(KeyCode.G)) {
transform.position = new Vector3 (transform.position.x, transform.position.y, transform.position.z - .01f);
}
to control my movement. Left click raises, right click lowers, t goes forward and g goes backward. The problem is this doesn’t take the pallet with it when I move it around because I’m skipping over physics by just moving the transform (Correct me if I’m wrong)
.
this is my jack. My plan was to have the player grab the hand and then just walk. the handle will pivot when they turn and the load would in turn follow. Can’t seem to get it working.
My initial idea was to set the end of the handle to a point on the character and pull it but it just moves the whole handle.
Any idea?
Thanks!
D3Duck
2
This might be a bit tough to do properly with ‘physics’, unless you want the pallet to fall off of the jack and do similar things like that.
If you just want it to follow along it’s probably best to make it a child of the player and then it will move along with the player when he walks. However this will then possibly move the pallet in a rather unrealistic way.
It kind of depends what effect you are trying to create exactly. You might even want to go crazy and use a Joint, but that would require some figuring out.