I have a script that im using to try and pick up something and then set it back down. here is my script.
if (PickedUp == 1) {
if (Physics.Raycast (transform.position, -Vector3.up, hit)) {
if (hit.distance <= 3) {
RaycastHit.rigidbody.transform.position = pickupplace;
}
}
else {
}
}
So this script says if a raycast hits, and it hits within 3, then assign the hit rigidbody to a transform location called pickupplace. Any idea what im doing wrong?
if you rather, i suppose im asking how to transform the position of the raycast hit rigidbody to the position of "pickupplace"
– Padgeshit.transform.position = pickupplace;
– flaviusxviiahh :D thank you. one more question, this script is attached onto my camera script and i am trying to have this raycast shoot out forwards, so Vector3.forward should work, but it isnt, any ideas?
– PadgesYou have a nasty habit of trying to get attributes out of the classes, instead of the relevant objects. Try transform.forward.
– flaviusxviiyea, i self taught myself all the JS i know so im kinda new to it :/
– Padges