playMaker

Author Topic: Smooth look at / local space?  (Read 5803 times)

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Smooth look at / local space?
« on: November 13, 2012, 03:34:12 PM »
Hello, if there are a bunch of threads/videos on this, i cant seem to find them, so sorry in advance if I'm being thick.

The world needs turrets so i'm having a look at what Playmaker has for this, the 'smooth look at' action seems like the natural choice but its just not happening for me  ???

In the XZ plane you can have 'keep vertical' ticked and it seems to do the job, but in the XY or on an angle no amount of messing with the up vector setting is delivering the desired results. Seems like 'keep vertical' works on the global Y axes and not object space?



All the arrows are tracking the green sphere, the blue scripted arrows are performing correctly using Mathf.Atan2 (ugh!), playmaker arrows are in red & you can see the two middle & right embedding themselves in fail. I've been using the rotation action with late update ticked to re-adjust but no joy so far.

What is the correct approach to doing this with PM?

package attached if anyone charitable desires to correct my wonky experiment.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth look at / local space?
« Reply #1 on: November 14, 2012, 02:13:07 AM »
Hi,

ok, to begin with your blue arrow will not work if I create one exactly where Point45 is. So for this one, you will have to modify the arrow position compare to its parent so that it points properly, no big deal.

I have tho ported your Blue arrow script into an action, so now you can have blue arrows controlled by PlayMaker.

Bye,

 Jean

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Smooth look at / local space?
« Reply #2 on: November 16, 2012, 11:48:14 AM »
This is still a huge cause of frustration for me, unity's solution for look rotations is 'Do the maths yourself jerk, but hey we made a crap trail renderer - enjoy'.

"Mathf.Atan2(targetPos.x - transform.position.x, targetPos.y - transform.position.y)* (180 / Mathf.PI) ;"

"Return.z = Return.z > 180 ? Return.z - 360 : Return.z;"

Screw ALL of that, unity has been punching me in the balls with this jibberish to the point where its making me want to quit for an engine that has actual scripting commands for making games.

http://constraints.path-o-logical.com/
Path-o-logicals Unity Constrains Smooth look At completely nails look rotations - when it works, damn thing takes an age to start up plus now & again it just does not start for me...joy.

Inspired by jean inserting my broken script into a custom action I've started making my first custom action for Unity Constrains Smooth look At. I got the target assigning done which is the important bit (you'll probably set the rest of the stuff in editor) but seeing as I use java & resources for custom actions in java are non existent this is as far as I can get for now.



Works pretty good right? ...Nope I can't clamp it  >:(

The blue arrow has the extracted rotation from its neighbour clamped (yay) but I'm unable clamp the object with the constraint itself. I would have thought playmakers rotate action would do the job but maybe Constraints wants me to clamp the target vector - in which case I'm back at square one with the maths bullcrap.

To summarise:

1. How can I clamp This thing?

2. Need the java syntax info for making custom actions

3. I would buy playmaker again for a  smooth look at action that just works no matter what.

« Last Edit: November 16, 2012, 11:50:17 AM by krakov73 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth look at / local space?
« Reply #3 on: November 16, 2012, 01:54:36 PM »
Hi,

 You seem very frustrated indeed  ;D  Relax. We all know how really upset it can be when it's not performing as you want.

It's difficult to satisfy everyone, and that's why you have the flexibility in scripts and all these math functions. Yes you have to learn trigonometry transforms gimbal locks quaternion and other matrix fun, but everything has its price when you want something very precise.

I have a different experience with Constraints from path-o-logical, I think it's the best constraint system you'll ever get, it's that level. If you know a better one, please tell me, I am willing to learn. I achieved a full gears and worm screw system with this and it's justing a brease. Can you describe exactly what is not performing?

 Regards JavaScript, what is it that you can't do for Actions? where do you get stuck? Why not doing them in c#, I mean the difference between javascript and c# is so minimal that I really suggest you work with c# and nothing else, you benefit from a much wider help online with the full .net docs from msdn to start with.

What do you mean by clamp? I don't think using constraint here is wise as well. You should really get the math, but I feel you really don't want to get into the trouble :)


 I have another solution in my mind to get this smooth look at as you want it. Allow me few days and come back to me at the end of next week if you haven't heard from me.

Bye,

 Jean

krakov73

  • Playmaker Newbie
  • *
  • Posts: 28
Re: Smooth look at / local space?
« Reply #4 on: November 16, 2012, 07:32:00 PM »
Just as I succesfully managed to clamp unity constraints rotations by script & thnking about sticking that in an action i took a closer look at what it was doing to my objects.



warping the crap out of them...yes i thought thats just the look i was going for, well done unity constraints you are fired get out of my project folder.

jean, your a total bro & i've got no right making demands of your time on this. Specificly what i'm trying to achieve is the same level of control i get with 3d applications & other game engines (well a certain 2d one) over object rotations with things like turrets. In 3dsmax its a breeze to set up turrets that behave like physical objects & all that trig matrix quaternion anti fun is done where it belongs - by my computer :)

I'm really keen to see what you've got in mind for this but i'll be patient as its probably more of a unity problem.

There are so many threads on the official forums about this subject that its just not funny, yet none of them have any decent examples, i'm sure i'm not alone in finding unity's lack of pre cooked commands a huge barrier in this area.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth look at / local space?
« Reply #5 on: November 19, 2012, 01:09:59 AM »
Hi,

 ok, so don't forget to bump this at the end of the week if you haven't heard from me, thanks

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Smooth look at / local space?
« Reply #6 on: September 09, 2013, 08:46:27 AM »
Hi,

 and one year later :) I think this will solve this issue you are having.

http://hutonggames.com/playmakerforum/index.php?topic=4908.msg23063;topicseen#new

Bye,

 Jean