Quantcast
Channel: Questions in topic: "quaternion.slerp"
Viewing all articles
Browse latest Browse all 133

Using Quaternion.Slerp() to rotate an NPC.

$
0
0
I'm having some issues with Quaternion.Slerp. I'm trying to simply rotate the NPC to where there player is standing when they are being talked to. Here's what I have for my starting dialogue function. function StartDialogue() { //has talked before hastalked = true; lookatplayer = (player.transform.position - transform. position).normalized; lookingRotation = Quaternion.LookRotation(lookatplayer); transform.rotation = Quaternion.Slerp(transform.rotation, lookingRotation, Time.deltaTime * rotationSpeed); dialogueHandler.currentNode = dialogueHandler.startingNode; dialogueHandler.AddText(dialogueHandler.nodes[dialogueHandler.startingNode].text); dialogueHandler.talking = true; talking = dialogueHandler.talking; playerState.istalking = talking; } Any help would be great.

Viewing all articles
Browse latest Browse all 133

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>