Jump to content

Animation/picture rotation


Recommended Posts

Hello.

I occured some strange problem while exploring how to make animation. I made custom picture. Let's say it is a campfire fire (attached file). When i try to use it, it doesn't rotate like dart from blow dart. Dart is always directed to target but my animation picture is always forwarding right since i painted it and posted in sprite like so. BUT blowdart dart is forwarding same direction in sprite like my picture and it is rotating! Dart fly uses

inst.AnimState:PlayAnimation("dart_pipe")

And my animation is actually "action-animation" which uses next code

.......
--making function of action "throw" projectile
myaction.fn = function(act)	  
	act.doer.AnimState:PlayAnimation("throw")    
	act.doer:DoTaskInTime(7*GLOBAL.FRAMES, function()        
		local projectile = GLOBAL.SpawnPrefab("campFire_projectile")           
		projectile:AddComponent("weapon")  
		projectile.components.weapon.damage=0
		projectile.Transform:SetPosition(act.doer.Transform:GetWorldPosition())        
		projectile.components.projectile:Throw(act.doer, act.target)    
	end)    	
	return true
end
AddAction(myaction)

Am i doing it wrong way? Is it possible to rotate it directing target?

igni-2.png

Edited by Amalleus
mistake
Link to comment
Share on other sites

2 hours ago, Amalleus said:

bump. Really need help with this. Projectile:RotateToTarget seems not working on my picture. It might be depended on pivot or something else

If it's similar to the other animations in the game you may need different faces for the animation, one for left, one for right, one for up, and one for down. Otherwise it'll always face in the same direction when you fire it and just slide over to the target. You might want to take a look at the Ewecus prefab and see how it's projectile works.

Link to comment
Share on other sites

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
 Share

×
  • Create New...