Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: mweyna on September 06, 2013, 02:39:53 AM

Title: Look At Direction appears to have some odd results
Post by: mweyna on September 06, 2013, 02:39:53 AM
So I noticed after updating to the latest playmaker that my FSMs that rely on Smooth Look At Direction don't seem to be properly pointing to their assigned objects, but rather have an offset of somewhere between 20/25 degrees, and are inconsistent if the object is closer or futher (even in the other two axis haven't changed). Anyone else seeing an issue here?
Title: Re: Look At Direction appears to have some odd results
Post by: Alex Chouls on September 06, 2013, 10:22:09 AM
The Smooth Look At Direction hasn't changed recently, but maybe you downloaded a version from the forums that hasn't been integrated into the main distribution yet...? The update would have overwritten any local changes to the action...
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on September 18, 2013, 01:53:56 AM
Definitely not. Within my scene I have the latest versions of A*, ArrayMaker, and Playmaker. Yet for some reason the action seems non-functional. I'd be happy to email the project to you if necessary.
Title: Re: Look At Direction appears to have some odd results
Post by: jeanfabre on September 18, 2013, 02:19:17 AM
Hi,

 Can you try on a simple scene, with a cube looking at another one. Once you master this, you can then apply it in  more complicated cases. With this kind of setup, it's usually ( even when you know how to work it out...) something you missed out in the set up that makes it behaving weird, in that case, I'll always start with the most minimal setup I can come up with and build up from there.

If you still have issues, let us know, I can make a small test scene to show it works.


bye,

 Jean
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on September 18, 2013, 02:40:20 AM
Hey Jean,

So that's the odd thing to me, I did the solo scene thing, worked without issue. However, when I applied it to my complex scene in the EXACT same manner using the Smooth Look At Direction directly above the FollowPath action, it didn't work. I'd be happy to email you a scene if you think it would be useful to see what the root of this could be.

- Ian
Title: Re: Look At Direction appears to have some odd results
Post by: jeanfabre on September 20, 2013, 02:25:01 AM
Hi,

 ok, pm me

bye,

 Jean
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on September 22, 2013, 03:43:35 PM
Email sent.
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on September 26, 2013, 03:20:40 PM
Any updates?
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 15, 2013, 04:03:14 PM
So still having this issue. I created a blank scene, ensured everything was updated and I get the following results (the middle cube is my target, the cube on the left is using a standard look at, and the cube on the right is using a Smooth Look At Direction).

(http://img189.imageshack.us/img189/7060/iamq.png)

On start of the scene it looks like it's facing but slightly off (when the cube is near 0 or 360 the look at direction seems much more accurate)

(http://img189.imageshack.us/img189/3295/venj.jpg)

You see here the Smooth LookAt Cube (SLA CUBE) rotates to face, but then gains another 45 degrees or so when the target cube is next to him.

(http://img132.imageshack.us/img132/8158/iti.png)

Depending on the distance of the target object from the cube, the rotate will change, even if the angle doesn't. So if the target cube is right next to the object, instead of being rotated 90 degrees it will be rotated about 135 degrees (looks like it's gaining 45 from somewhere). If you pull the target out on the same sideway axis, it will eventually get far enough away that the SLA will have the cube properly face the target cube (although in my test scene you have to pull him damn near off camera)

Any thoughts to the odd behaviors?


Title: Re: Look At Direction appears to have some odd results
Post by: Lane on October 15, 2013, 04:18:53 PM
I haven't used the action before, so I gave it a whirl.... I had no clue what it was doing, not what I was expecting.

Working example, perhaps?
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 16, 2013, 12:33:12 AM
A test scene is fairly simple to create, for my last post I simply created two cube objects, named one "Target" and then created a FSM on the second cube with a single Get Position of the "Target" and Smooth Look At Direction on it. From my understanding (and maybe Jean can prove a more through answer), it's basically a lookat with a controllable "forward" axis.
Title: Re: Look At Direction appears to have some odd results
Post by: jeanfabre on October 16, 2013, 01:47:55 AM
Hi,

 Yes, if you could share that simple repro project that would be good ( the project you sent me I can't really make sense of what is actually going wrong unfortunatly)

bye,

 Jean
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 16, 2013, 11:31:12 AM
www.ianweyna.com/test/ForJean.rar (ftp://www.ianweyna.com/test/ForJean.rar)

There ya guys go, the simple test scene.
Title: Re: Look At Direction appears to have some odd results
Post by: Lane on October 16, 2013, 11:38:10 AM
Link requires a password and login.
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 17, 2013, 12:16:35 AM
Guess since I was signed into the server already didnt prompt me, here is a public link, great catch! -

http://www.filedropper.com/forjean
Title: Re: Look At Direction appears to have some odd results
Post by: jeanfabre on October 17, 2013, 01:29:38 AM
Hi,

 Ok, I get it now...

 You are mistaken the meaning of the action "SmoothLookAtDirection". It looks at a direction, not a target. For this you need smoothLookAt,

 a "Direction" is not a position in space, it's a direction as "angles". So putting the position of the target in this "direction" property, mean that you will use the position as an indication of the direction compare to the center of the world. To witness this, grab the target cube and rotate it around the center of the plane, you'll see that the "smoothLookAtDirection" understand this as the angle between the center of the plane and your target.

 Hope that make sense.

bye,

 Jean
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 17, 2013, 01:59:46 AM
So if I say wanted to have my enemy unit navigate around a hallway to find it's target, if I just use a Look At it will look across the map independent of it's position to the hallways. What would be the best way so it will always look forward as it's navigating the hallways to it's target destination? For instance, if I was going to navigate from my bedroom to my office in my house, I'm not just going to have my head facing my office, it will face forwards as I walk across the room to the door to the next room.
Title: Re: Look At Direction appears to have some odd results
Post by: jeanfabre on October 17, 2013, 05:24:17 AM
Hi,

 For this, you need a pathfinding system, that will find the path to the target, and then your character is going to look in the direction of the path as it walks. Any other way means in practice building a pathfinding system of some sort.

bye,

 Jean
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 17, 2013, 11:14:44 AM
So I've been using A* for pathfinding which generates that path, and my game object will translate it. However there is to my knowledge no way to expose the points on the node to look at, nor a way to say "if you've reached node 1 on path, look at node 2". The problem is that the character when set up exactly like this, doesn't look in a forward direction. Any thoughts?
Title: Re: Look At Direction appears to have some odd results
Post by: Lane on October 17, 2013, 11:18:23 AM
iirc there is some 'orient to path option' in the A* settings.
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 17, 2013, 12:19:59 PM
There is or isn't? I'm looking at my A* now and can't seem to find that option on the Astar Path script.
Title: Re: Look At Direction appears to have some odd results
Post by: mweyna on October 18, 2013, 02:29:48 AM
With help from Kiriri, appears that my order was wrong on my problem. When using A* the Look At Direction action needs to follow the MoveTo, not appear ahead of it. Consider this issue SOLVED.