Hello, I have an annoying problem and I seached everywhre but couldn’t find the solution.
I need t ochange the origin point of a raycast, I defined localOffset for it and I did exactly like all solutions that are supposed to work, but it is just not working:
All it does is change the direction of the ray, the origin however still stays at the origin of the game object (player character in this case, which is far too low).
So now the ray goes forward and up a bit.
I want to cast from about middle height (0.5).
var localOffset = transform.position + transform.up * 0.5;
var hitCollision : RaycastHit;
var CollisionCheckRange : int = 1.1;
if (Physics.Raycast (localOffset, transform.forward, hitCollision, CollisionCheckRange))
Indeed a great idea. I just make it a child of the player object. Now I just have to find out how to access the variables it puts out in my main movement script, a whole new can of worms opened so to speak :) But I have to learn it anways for my elevator script, so thanks for the suggestion! I will flag your answer as a solution once I have it all working correctly, it may take a few days but I have this question page bookmarked.
– ChernoWow, I cannot believe you acknowledged that you were told 30 minutes ago, and I just told you on your other question 5 minutes ago. You won't be posting another comment as an answer again, will you... no? good. * Watch : http://video.unity3d.com/video/7720450/tutorials-using-unity-answers * Read : http://answers.unity3d.com/page/newuser.html
– AlucardJayThis is also what I'm doing - I have guns on a ship and each has an Empty at the correct position that I use for starting various position-based checks at the right location. I made sure each faces "forward" in the direction I expect too in order to minimize the amount of walking up and down the object tree as needed. In short, Fattie is spot on.
– Dracoratto access variables, check out the tutorials on unityGEMS.com it's very easy and it is the core of unity programming!
– Fattie