Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Head Turn on Hotspot that has a CenterPoint Override

All right, working on my 2.5D version of ENCODYA, I'm finding some issues with the script Chris wrote me to re-center the hotspot and the Head Turn to hotspot.
Under settings I've activated "Player turns head to active hotspot". And everything works great when I don't have the custom script to re-center the hotspot center point.
Once I assign the script, the head is not turning properly (i.e. not moving at all, or moving just a tiny bit and snapped).

This is the original script:.

Is there something wrong with the script? (for example in the "z-depth" part)
Or is there any other way to make the center override working with turning the head of my player?
I'm wondering what is causing troubles...

Thanks a lot!
N.

Comments

  • The script assumes a 2D view, because it works by analysing the difference in z-position between the Hotspot and the camera.

    If you're working in 2.5D, this would only continue to work if the camera is looking straight down the z-axis.

    You could try just using the distance instead, i.e.:

    float zDepth = Vector3.Distance (hotspot.transform.position - Camera.main.transform.position);
    
  • edited November 2019

    Thanks a lot for your reply.
    But I got the error:
    "There is no argument given that corresponds to the required formal parameter 'b' of 'Vector3.Distance(Vector3, Vector3)'"

    Have I done something wrong? I simply replaced the "float" line (line 22 on the original script pasted above) with the one you suggested...

  • My mistake.

    float zDepth = Vector3.Distance (hotspot.transform.position, Camera.main.transform.position);
    
  • Perfect! It works now!
    Thanks a lot!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!