• Create Account

# altra4u

Member Since 10 Feb 2008
Offline Last Active Apr 23 2012 11:11 PM

### Most efficient way to do front-back test

22 April 2012 - 08:35 PM

Hi Guys
I was wondering what would be the least expensive way of saying here is my character facing this direction and I want to return a boolean for other characters if they are within a 180 degree curve in front of me.

I can think of doing a dot product between my front vector, V1, and vector from target to me, V2, but that will involve a doing a square root operation in finding the length of V2 so I was thinking what others have to say.

Thoughts welcome.
Thanks.

### Re:Distance to target check

06 April 2012 - 01:03 PM

Hi
So normally a distance check would be done by simply doing distance < range check. So lets say distance between character a from character b.
However to optimize one would do d^2 < r^2 check.

However if one has to include the radius of each of the characters then the check would be

I'm trying to think of some way where I could keep the squared optimization and also be able to include the radii part.
Thoughts??
I'm discounting this one
(d^2 - r^2)/(d+r)
as that will need the square root value of d
Thanks.

### Positioning camera to see mentioned points

12 July 2011 - 11:29 PM

Hi

Lets say I have 3 points I want to make sure are included in the camera's vision frustum.
How can I ensure that the camera is placed at the most optimal position closest to the points but far enough to be able to see all of them together?

Thanks

### Hashmap

06 July 2011 - 08:08 PM

Hello All

I was wondering if a hashmap gets assigned memory the moment you declare the variable or when you actually assign elements.
I'm not a fan of hashmaps and had like to avoid them if possible for all the various reasons.

Thoughts

Thanks

### Most efficient way to do facing test

06 July 2011 - 02:48 PM

Hello All

Wat do you think is the most efficient way to test if my character is facing say another character.
It could be as simple as front and back.
What would need to change if it became something like having an angle of sight?

cos(theta)is definitely not a good way. I'm thinking of using arctan2.

Thoughts.

Thanks.

PARTNERS