You are viewing a single comment's thread from:

RE: Investigating line of sight - Problem solved by just using brainpower

in #unity8 years ago

Isn't coding fun? Local space center, or an objects root is what your talking about. And can be changed with just about any 3d software. For your last issue.....
Are you updating on Update, or FixedUpdate?

Sort:  

Neither, I'm using the OnTriggerStay function so I need to find out how to put it into the Void Update so it will constantly check for the player every frame. Embarassingly, I admit I haven't had to do this before I don't think, unless I used FixedUpdate in a tutorial and I completely forgot about it.

As expected when I wrap any sort of other void function around my OnTriggerStay the engine complains a lot.

I think I found the main answer here.

http://answers.unity3d.com/questions/887630/ontriggerstay-not-updating-every-frame.html

Oh and they have all sorts of names for it, which is what initially threw me off when I first learned about it when experimenting with building placement, once I found out more I got all sorts of tutorials on the subject and coding got a bit easier in regards to raycasts.

Yes, that is it. Do that, however; just remember FixedUpdate is not every frame, so frame dependent should be Update. Should not make a difference being a psychics raycast. Imho should not exactly be frame dependent for a simple line of sight either....so FixedUpdate should do fine. Sorry if it seems confusing.

No problem, I get it, I get that it 'shouldn't' be as you say but from the way I've seen it working it clearly is not calculating every frame, so it's a good idea just to put it in to be safe and prevent any bugs.

Coin Marketplace

STEEM 0.16
TRX 0.12
JST 0.026
BTC 60313.79
ETH 2889.34
USDT 1.00
SBD 2.47