Jump to content

Lost in the world of rotations


You are about to reply to a thread that has been inactive for 3196 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hey guys.

 

Been trying to put together a turret script for a vice tank I've been building, I've got most of it sorted but however I've run into a impass when It comes to the prim acting as the spawn point for the cannon bullet, when the tank turns and I look in a direction I want the prim to turn to face the direction I'm looking in - however when I turn the tank and look, the whole prim flips and rotates based in the direction I've turned not the direction I've been looking in.

 if(buf & AGENT_MOUSELOOK){llGetLocalRot();      

llSetLocalRot((root = ZERO_ROTATION / root) * llDetectedRot(0));

 

Is the script line, but I can't figure out why its flipping based on direction of facing of the root prim - feels like I'm missing something simple, but I can't for the life of me pick it.

 

 

Link to post
Share on other sites

I don't quite understand from the fragment of code what's supposed to happen -- in particular, it's not clear who is in mouselook or whose (or what's) rotation is being detected.

Be that as it may, this tutorial by Chalice Yao, over at SLU, help you do what you're trying to: http://www.sluniverse.com/php/vb/script-library/40698-kept-simple-rotate-object-towards.html

Link to post
Share on other sites

Innula Zenovka wrote:

I don't quite understand from the fragment of code what's supposed to happen -- in particular, it's not clear who is in mouselook or whose (or what's) rotation is being detected.

Be that as it may, this tutorial by Chalice Yao, over at SLU, help you do what you're trying to: 

Thanks, however that ended up not being the problem.

 

Turns out the prim was taking rotations from 2 points - camera and where the tank's camera was set.

 

Now I just need to figure out how to get it to ignore the tank perspective camera =(

Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3196 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...