Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
xraithex

which direction of player is facing

Question

Hi thanks for viewing again I'm in need of a simple solution... I cannot think of how to ask it though :

I need a player to know if he is facing a trigger.... in the forword direction ... Meaning

If the player is in front a then if his direction is facing the trigger then he is able to do the set of commands ...

Without raycasting ... im thinking vector3.angle i'm just not sure how to say if player forword direction facing my direction.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Without using raycast is a huge hassle. With raycast you can detect any object and distance with one simple cast. Any other method will require alot of work and assigning several variables and creating for statements to iterate through every variable. Also, by using a vector3 angle, you acquire an angle, hence the angle part. That means the object can be detected even if the player is not rotated directly towards it. I'd write you an angle script but it would take alot of time I don't have. Just wanted to give you a little heads up on what your trying to do

Share this post


Link to post
Share on other sites

  • 0

Yeah I did alittle research the actual angle I can do I was just wondering what the correct functions were within unity . Thanks though man yeah the only problem about raycast is the actual frames it builds up line cast would be the better way to go.... just need to add alittle more code with it to get it working proper . So I decided to write out the mouse looks in java and actually have the character rotate around and face the ladder before moving... :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...