Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tellemstevedave

Pages: [1]
1
Support / Best way to rotate a sprite towards a point?
« on: June 23, 2013, 03:35:15 am »
I could use some help.  I have a ship in my scene that follows a path successfully.  I want the ship to orient itself to the path with a maximum rate of rotation.  I'd really like to use rotateTowards as it seems to handle all of this.  But the problem is that this function and many others assume that and object with a local rotation of 0,0,0 is facing forward on z.

What is the best way for me to rotate a sprite x degress per second towards a point?

2
Support / Re: Offset ray from 2dtk camera
« on: June 08, 2013, 11:50:11 pm »
That did it!  Thanks.  Man that was confusing.  I had no idea collider cap did that.  If it sad collision side or something I might have got the hint.

Thanks!

3
Support / Re: Offset ray from 2dtk camera
« on: June 08, 2013, 10:52:35 pm »
Thanks for the quick reply!

It turns out if I separate the game cam it looks like the projection is correct and goes through the ship.  I don't know why the ray doesn't detect the mesh collision on the ship though.

4
Support / Offset ray from 2dtk camera
« on: June 08, 2013, 08:39:45 pm »
I'm trying to shoot a ray from the 2ktdcamera to see if the mouse it colliding with my sprite.  It doesn't work correctly so I'm drawing the line in yellow.  It appears offset from the screen a bunch.  Notice how high up the yellow line is in the scene view.

Here's my relevant code:
public Camera gameCamera; // 2dtk camera set from editor
ray = gameCamera.ScreenPointToRay(touchPosition);
if (collider.Raycast(ray, out(hit), 10000.0f)){
     overObject = true;
}
else{
   overObject = false;
}
Debug.DrawRay(ray.origin, ray.direction * 10, Color.yellow);

Any thoughts on what is going wrong would be awesome.  Thanks.


Pages: [1]