[RESOLVED] BoundingBox & Player.Position

Fixed bugs, solved problems, and old reports.
Locked
BinaryX
Offline
Posts: 8
Joined: October 13th, 2011, 3:52 pm
Location: The Netherlands
Contact:

[RESOLVED] BoundingBox & Player.Position

Post by BinaryX »

Code: Select all

  Position pos = player.Position;
                return this.container.Contains(pos.GetFixed()) || this.container.Contains(pos) || this.container.Contains(pos.ToVector3I());
This piece of code always returns false, its used for my new portal system.
container contains 2 position, 1 from the bottom left corner, 1 from the top right corner.
When i stand inside the boundingbox ingame nothing happens, no log message or anything, tried to debug it already.

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: BoundingBox & Player.Position

Post by fragmer »

Player coordinates are 32 units per block. All building, map, and zone-related coordinates are 1 unit per block. Make sure you do the conversion before testing bounds.

BinaryX
Offline
Posts: 8
Joined: October 13th, 2011, 3:52 pm
Location: The Netherlands
Contact:

Re: BoundingBox & Player.Position

Post by BinaryX »

So divide by 32?

User avatar
fragmer
fCraft Developer
Offline
Posts: 1386
Joined: May 21st, 2011, 10:53 pm

Re: BoundingBox & Player.Position

Post by fragmer »

Divide by 32, and do proper rounding.

Locked