#Using vector3.down with Raycasts
20 messages · Page 1 of 1 (latest)
is this script attached to player gameobject?
yes
Try: transform.down instead of Vector3.down
and where do i put that exacly
Here
i said ignore this line of code as it was a place holder for something, the variable ray is already going to chanege because its getting set to transform.position,direction
Then remove or comment this line of code.
Can you explain in detail?
You see those green ray casts? The direction will be pointing downwards. Now whenever the plsyer(the one that his this script) moves or gets on a slope the ray casts will still be pointing downwards. I want the rays to be affected by vector 3.down
Ok then how do I make the rays follow the rotation of the player
Piko already mentioned a great solution
see here!
Vector3.down works fine but how do I still retain the shape of a circle they are forming?
Try:
Ray ray = new Ray(transform.position, direction - transform.down);
Or +
Why do you say it works fine?