playMaker

Author Topic: Sprite iTween Look At Through Dummy Game Object  (Read 5238 times)

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Sprite iTween Look At Through Dummy Game Object
« on: December 09, 2013, 05:00:52 PM »
Hi, I've been trying to figure out how to handle this for a while, and I keep running into the same problem. What I'm trying to do is have an enemy first face directly at the player, and then charge at them. The part the I can't figure out yet is how to get the enemy to look for and face the player. I've used the various Look related Actions and that doesn't seem to help. The problem is that the sprite/game object is always rotating on the X and Y axis as well as the Z axis. I only want Z axis rotation. How do I achieve this?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #1 on: December 10, 2013, 01:54:31 PM »
Hi,

 Don't use iTween for this. Only use a regular "look at" action.

bye,

 Jean

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #2 on: December 10, 2013, 04:56:30 PM »
Okay, I've started with that and now it still doesn't seem to work for me. What other actions should I use in conjunction with the look at? I'm trying to get the direction of the target and store it as a variable.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #3 on: December 11, 2013, 02:23:08 PM »
Hi,

 To get the direction, use "Transform direction" action.

bye,

 Jean

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #4 on: December 11, 2013, 06:05:13 PM »
Okay, so this is what I've got so far, and there's no change in the behaviour. I hope the screen caps help illustrate what I've got.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #5 on: December 11, 2013, 06:30:17 PM »
You don't need the Player Position vector3 if you're already supplying it a GameObject to look at.

Use Move Towards and Look At. The only info those actions need is the target object.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #6 on: December 11, 2013, 06:50:54 PM »
Okay, I tried that and it just rushes the player, instead of facing the player. That's what I'm looking for.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #7 on: December 11, 2013, 07:38:43 PM »
Are you making a top down 2d game where the camera is actually looking down?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #8 on: December 11, 2013, 07:54:01 PM »
Yeah, exactly that. I'm also using the Unity 2D settings for this. How is this affecting the actions I'm using?

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #9 on: December 11, 2013, 08:34:26 PM »
It makes a difference because of the direction the camera is looking versus the facing direction of the sprite. Generally Z positive is considered forward, so Look At is changing X and Y to aim Z positive directly at the target object. This has weird effects if you're looking along the wrong axis with the camera and the character world space is not assuming Z is forward. Move towards wouldn't be affected because its simply translating between two positions and doesn't care about which way is forward, thats why you need to have something not only move toward an object, but also look at it to appear as it is actually going forward.

However, I don't do any 2D work and the new 2D Unity features are foreign to me so I don't have any practical feedback on how those actions work with 2D shapes. Technically they all should work but their actual behaviors are going to be different if you have a case where Z isn't the sprites look direction. You can always manually figure the angles out with other actions if that is indeed the problem.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Phillament

  • Playmaker Newbie
  • *
  • Posts: 44
Re: Sprite iTween Look At Through Dummy Game Object
« Reply #10 on: December 11, 2013, 10:44:40 PM »
Wow, thanks for that feedback. I'll probably end up making a shoestring and bubble gum hack for what I want to do in my game, XD.