#Using vector3.down with Raycasts

20 messages · Page 1 of 1 (latest)

round folio
#

ignore the first Ray ray = new Ray(transform.position,Vector3.down); as it is a plceholder

real ridge
#

is this script attached to player gameobject?

round folio
#

yes

real ridge
#

Try: transform.down instead of Vector3.down

round folio
#

and where do i put that exacly

round folio
#

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

real ridge
#

Then remove or comment this line of code.

round folio
#

Nope

#

Same thing

real ridge
#

Can you explain in detail?

round folio
#

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

young nova
#

vector3.down is literally just (0, -1, 0)

#

rays cannot be affected by this?

round folio
#

Ok then how do I make the rays follow the rotation of the player

young nova
#

Piko already mentioned a great solution

young nova
round folio
#

Vector3.down works fine but how do I still retain the shape of a circle they are forming?

real ridge
#

Try:
Ray ray = new Ray(transform.position, direction - transform.down);
Or +