Offset camera's EntityRadius (eyes & body)

Blitz3D Forums/Blitz3D Beginners Area/Offset camera's EntityRadius (eyes & body)

Tobo(Posted 2009) [#1]
Dear all,

I'm just playing about with collisions and scales and have come across a problem I'm too tired to get my head around (hard day).

I've knocked together a room with some steps which are 8 units high each and end at a platform. Please see this screen grab which shows the front X/Y view...


Here is my code...
Graphics3D 800,600,32,2
SetBuffer BackBuffer()

room_col=1
cam_col=2


room=LoadMesh("room3.b3d")
EntityType room,room_col

cam=CreateCamera()
PositionEntity cam,0,64,60
EntityType cam,cam_col
EntityRadius cam,16,50

Collisions cam_col,room_col,2,3

While Not KeyDown(1)

	If KeyDown(208) MoveEntity cam,0,0,-2
	If KeyDown(200) MoveEntity cam,0,0,2
	If KeyDown(205) TurnEntity cam,0,-1,0
	If KeyDown(203) TurnEntity cam,0,1,0

	TranslateEntity cam,0,-1,0
	
	UpdateWorld
	RenderWorld
	Flip

Wend
End


As you can see, the [available] height of my room is 128 units. As I'm using the EntityRadius' Yradius, I can't go above half this height, 64 units (in fact, 64 wont let me move the player), so I'm stuck with my player's eyes being half-way up the height of the room or less.

So question 1)

Can I offset my player's eyes from its collision EntityRadius (basically have them above it).

And question 2)

........ahhh - wait a minute - brainwave!

.....is there anything to stop me having two collision spheres for my player's collision? One to check for steps/ledges etc, and another based above it to see if I can fit under doors etc? Legs and body, as it were.

Hope the above makes sense. I'm rather tired.

Many thanks.


Tobo


Yasha(Posted 2009) [#2]
Make the player a pivot, and apply the collision settings and movement to this; then create the camera as a child of the pivot, without collision information of its own; then position the camera at whatever offset you require. This ought to be simpler than trying to set up two collision spheres.


GIB3D(Posted 2009) [#3]
Hey isn't that Hammer? The map editor for Half-Life 2 and the other games like it?


Tobo(Posted 2009) [#4]
@Yasha

I don't know much (anything) about pivots; wont your method mean that the player rotates/pitches around its belly, or is that not an issue?


@GIA_Green_Fire

3D World Studio


Yasha(Posted 2009) [#5]
A pivot is an entity without a mesh or camera or any other features - just a point in space. They're useful as parent entities or other kinds of control point.

Depending upon how you applied the movement to the player, it could mean they rotate around their belly (and therefore centre of mass, so not all bad) - for yaw, this should be fine if the camera is only offset in the Y axis, and it would be essential in order to be moving the player the right way with the arrow keys. I assume you're going for vaguely standard FPS controls? In which case you would not pitch the player, but the camera, as the arrows normally control the player's feet rather than letting you fly up in the air when you look up. Applying yaw to the parent and pitch to the child is a very common technique for manipulating cameras.