playMaker

Author Topic: Animations while looking at a certain world position.  (Read 3251 times)

TIGGYsmalls

  • Junior Playmaker
  • **
  • Posts: 80
Animations while looking at a certain world position.
« on: March 15, 2013, 06:26:08 PM »
Hi, I have an isometric game with a little guy running about. I followed the animation graph tutorial and got him moving with animations.

But now I want to do something a bit more complex. I have it so he looks at the mouse's position when LMB is held (what he is firing at) and don't know what to do to get the correct animations to play.

He should walk or run forwards and backwards when moving towards or away from the point he is looking at.

He should strafe around the point he is looking at. 

I was thinking, create an empty game object that always faces the mouses world position and using the axis off that to drive the animations. Is that a good starting point?

I had something but realised that it only worked on the world axis.

Any other suggestions?

TIGGYsmalls

  • Junior Playmaker
  • **
  • Posts: 80
Re: Animations while looking at a certain world position.
« Reply #1 on: March 18, 2013, 09:01:25 AM »
Anyone?

I want the same set up as Angry Bots. I cant figure this out.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations while looking at a certain world position.
« Reply #2 on: March 18, 2013, 09:20:06 AM »
Hi,

 it really depends on how you did your character set up. but basically, you simply have the gameObject to look at at the mouse point on the ground plane, for this I made a custom action a while ago.

http://hutonggames.com/playmakerforum/index.php?topic=272.msg9976#msg9976

basically this action will let you know the world position of the mouse on the ground, use this to have your character looking at.

bye,

 Jean

TIGGYsmalls

  • Junior Playmaker
  • **
  • Posts: 80
Re: Animations while looking at a certain world position.
« Reply #3 on: March 18, 2013, 05:55:31 PM »
Yeah, I've done that. When I'm firing he looks at the mouse point in the world.

But I have no idea how to get him to strafe and walk backwards and forwards around this point. At the moment its just the walk/run animation that plays.

I had something working in the X axis of the game but when you turn you use the Z axis the strafe stops working.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations while looking at a certain world position.
« Reply #4 on: March 19, 2013, 01:22:15 AM »
Hi,

you need to use the local axis of your player to move it forward.

How do you move your player currently? if you use translate, make sure you select "self" for the "space" property, then you will always translate relative to the player orientation.

bye,

 Jean

TIGGYsmalls

  • Junior Playmaker
  • **
  • Posts: 80
Re: Animations while looking at a certain world position.
« Reply #5 on: March 26, 2013, 07:01:52 AM »
marktidswell.co.uk/Desktop.html

His axis is of the main camera.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Animations while looking at a certain world position.
« Reply #6 on: March 27, 2013, 07:53:38 AM »
Hi,

 ok, that will be a mecanim set up indeed, where your job inside playmaker is to informa about the direction, and then mecanim play the correct animation.

 look at the mecanim demo I did, for the "generic Skeleton Playmaker.unity scene"

https://hutonggames.fogbugz.com/default.asp?W1031

open the animator for Mine bot Playmaker gameObject

 open the "loco* node, and see how the left, forward, right and back anim where plugged beased ont he direction parameter. This is what you need to do.

bye,

 Jean