Jump to content

Question about follow camera using 2.0alpha


Lerige
 Share

Recommended Posts

Hi all,

 

Since this is my first post here, I'll start with congratulations to the developers and contributors of this library. Very nice work.

So nice that have started to play with it :)

 

I have a question regarding the follow camera between 1.14 and 2.0 alpha.

I have no issue using 1.14. But it seems the camera is broken in 2.0:

  • with 1.14 cameraTarget.rotation.y will return negative values if this angle is greater than PI.
  • with 2.0 it will return positive values in any case (no mean to make a difference between PI/2 and -PI/2 for example, the value is PI/2 in both cases).

Any explanation for this behavior ?

I hope the topic has not been answered elsewhere, but I found nothing.

Link to comment
Share on other sites

 0,  1, 2, 3

-3,-2,-1,-0

 

I think ray

 

(And I'm drunk btw fyi, that's the beauty of it all)

 

this.ray= new Phaser.Line(0, 0, 0, 0);//you attach that to anywhere, like yourSprite.ray or whatever)

this.ray.setTo(this.x, this.body.y+map.tileHeight, obj.x, obj.body.y+map.tileHeight);//"this being the thing ray is attached to, of course, like kites, in the sky, attached to things around)

 

And then from this point you get tons of stuufs.

Such as, an angle :

 

this.ray.angle

 

 

And A freaking distance

 

this.ray.length

 

 

 

With those two things (whatever was your question) 85% of your projectile stuffs are done.

But yeah angle.

See beginneng of post for what's returned.

Link to comment
Share on other sites

Thanks for your answer and I have to apologize cause it was a too fast question...

 

I've just found the answer : I was using ToEulerAngles to define my target rotation from a physic engine... and ToEulerAngles has been rewritten between 1.14 and 2.0...

 

I've just still have to understand the difference now :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...