Jump to content

Sprite:GetAngle() always returns 0


thehankinator
 Share

Recommended Posts

Calling GetAngle() on a sprite set to Billboard mode is always returning 0. Here is how I set it up:

1) Create a sprite

2) Set it to Billboard mode

3) Assign a material

4) Put this script on it

function Script:UpdateWorld()
	System:Print(self.entity:GetAngle())
end

The billboard appears to be working (always facing the camera) but the script always prints 0. I tried casting it to a sprite ( tolua.cast(self.entity,"Sprite") ) and calling GetAngle on that but no change. Any idea what I am doing wrong?

Link to comment
Share on other sites

The GetAngle() returns the rotation of the 2D plane set from SetAngle() apparently. If you rotate your sprite with SetAngle(), it doesn't change the angle of a sprite in billboard mode in reference to the camera - it changes the rotation of the 2D plane around its center.

And it appears that the sprites' rotation in relation to the camera does not have anything to do with the sprite's 3D rotation - I assume since its probably a shader controlling the rotation?

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