realbasic-games
[Top] [All Lists]

Re: WorldToObjectTransform question

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: WorldToObjectTransform question
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Fri, 11 Jun 2004 14:46:35 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
List-help: <mailto:realbasic-games-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Games <realbasic-games.lists.realsoftware.com>
List-post: <mailto:realbasic-games@lists.realsoftware.com>
References: <8E81700E-BBDD-11D8-BA86-000A957887E6 at goodlearning dot com>
At 2:28 PM -0500 6/11/04, Paul Kaiser wrote:

WorldToObjectTransform gives me a Vector3D that, when added to the original Vector3D, would get me to the destonation Vector3D, if I understand correctly:

relativeVector3D = enemy.WorldToObjectTransform(player.position)

Well, sort of -- it also takes orientation and scale into account, not just position.

From this, if I wanted to, I could get the x and y difference from enemy to player:
relativeVector3D.position.x
relativeVector3D.position.y

Well yes, but you can more easily get that via enemy.position.Minus( player.position ).

How can I get the relative angle from enemy to player?

In a 2D game (or 2D situation in a 3D game), I'd recommend using ATan2. That's what it's for, and it's very good at it. :)

Best,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>