Jump to content

How to use AlignToVector()


Slastraf
 Share

Recommended Posts

	--Rotate 
	local otherRot = self.otherEntity:GetRotation(true)
	local camRot = self.camera:GetRotation(true)
	if(otherRot ~= camRot) then
		self.otherEntity:AlignToVector(90, camRot.y, 0, 1)
	end

I want to rotate an entity to match the camera's rotation on the y axis.

However, when I use this exact script, it just sets a random rotation when I look more or less than 0 degrees on the y axis. 

How can it be fixed ? The Api reference to this has a broken script, it looks like this, btw light->SetRotation(35,35,0);<br /> <br /> //Create a model<br />

 

 

Link to comment
Share on other sites

Without seeing this in action and the rest of your code, its hard to tell what exactly the issue could be. Why are you aligning the entity by 90 degrees in the X-axis as well? Seems like what you are trying to achieve based on your description could be solved just by setting the 'self.otherEntity' rotation by using SetRotation()? But again, just a guess since no example to test.

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

 Share

×
×
  • Create New...