Character/Vehicle

Blitz3D Forums/Blitz3D Beginners Area/Character/Vehicle

I have tried to do this, but nothing has worked.

Ok, I have a character, and a vehicle, I want him to get into the vehicle, by pressing the 'd' key when he is 1 blitz unit away from the vehicle.
I have messed with the entity distance command, and hideentity and stuff, I just cannot get anything to work.

EntityDistance should work fine for checking whether the character is near enough to the vehicle, or not.

probably going to have to post up some code

Here is the car
VEHICLE1=LoadMesh("f360.3ds")
Cartex=LoadTexture("fskin.jpg")
EntityTexture VEHICLE1,Cartex
PositionEntity VEHICLE1,-22,6,202
ScaleEntity VEHICLE1,2,2,2
EntityRadius VEHICLE1,.2
EntityType VEHICLE1,Car

Here is the character
char=LoadAnimMesh("dwarf2.b3d")
chartex=LoadTexture("dwarf2.jpg")
PositionEntity char,-50,6,120
ScaleEntity char,.085,.085,.085
EntityType char,Player
EntityRadius char,.2


dont laugh
If EntityDistance (char,VEHICLE1)<1 And If KeyDown(32) Then 
EntityParent VEHICLE1,char
HideEntity char
End If 

also, how do you change the controls that normally control the character to control the vehicle

I am doing this project to learn how to do the stuff, so if you recognize the names of the meshes from psionic, I am just using them as place holders.

If EntityDistance (char,VEHICLE1)<1 And If KeyDown(32) Then
Does that even compile? Try:
If EntityDistance (char,VEHICLE1)<1 And KeyDown(32) Then


I just typed it up now, since I deleted the original, that if doesn't belong there.

My code definatly does not work, I put what I put on the post again, and made sure, I did not put the second if in there, and nothing happened at all.

why not make the vehicle pickable then do an entitypick and if they can pick the truck and they are within one unit then they can get in

I know even less about that

Is there any way to do it that is closer to this:
If EntityDistance (char,VEHICLE1)<1 And KeyDown(32) Then 
EntityParent char,VEHICLE1
HideEntity char
End If 


well, maybe the char are further away than "1" from the vehicle? Run the code in debug mode, and add the line

debuglog "distance:" + entitydistance(char,vehicle1)

also change your if to:

If KeyDown(32) Then 
   If EntityDistance (char,VEHICLE1)<1 then
      ; do your stuff here
   end if
end if


why? because entitydistance takes time - of course on a simple example it wouldn't matter, but if you do several calls on every loop, things will slow down.

So changing the If's you'll only check when the user press the apropriate key, instead of checking all the time...

Entitydistance is fine to use many many hundreds of times. It's a very simple calculation. What might be happening is the distance you have specified is less than the collision radius of the car. Try setting a bigger value.

To do with the code part, try structuring the code using a mode variable:

If mode = 1 then
   ;do controls for walking
ElseIf mode = 2 then
   ;do controls for vehicle driving
End If


To clarify what both Slotman and Ross pointed out, bear in mind that EntityDistance is calculating from the center of the entity (or rather the origin point, which is typically somewhere in the middle) not from its outside edge. Thus, if the vehicle is bigger than 1, then the character is never actually getting close enough.

So yeah try setting the distance check to a bigger value and see if that works.

Remember that one of the entities is an ANIMMESH - it may be that the child mesh that is the actual visual character is not near the centre of the entity.

Try finding the anim mesh's child that is the visual mesh, then using entitydistance on that.

Here is the entire code for this project.
; Game
; ---------------------
AppTitle "Game"
Graphics3D 1024,768,32,2
SetBuffer BackBuffer()

;Collision Group
Player=1

<img src="http://blitz3dstuff.googlepages.com/untitled.JPG">



Obstacle=2
Ground=3
Car=4


;The controlable Character
char=LoadAnimMesh("dwarf2.b3d")
chartex=LoadTexture("dwarf2.jpg")
PositionEntity char,-50,6,120
ScaleEntity char,.085,.085,.085
EntityType char,Player
EntityRadius char,.2

;Camera
cam1=CreateCamera()
PositionEntity cam1,EntityX(char),EntityY(char)+6,EntityZ(char)-7
EntityParent cam1,char
RotateEntity cam1,25,0,0

;Light
lite1=CreateLight(1)
RotateEntity lite1,90,0,0


;Tree2
tree2=LoadMesh("Tree1.3ds")
PositionEntity tree2, -20,5,116
ScaleEntity tree2,.05,.05,.05
EntityType tree2,Obstacle
;cage
cage=LoadMesh("thecage.3ds")
ScaleEntity cage,.040,.040,.040
PositionEntity cage,EntityX(tree2)+4,EntityY(tree2)+1.2,EntityZ(tree2)-2
Global metal=LoadTexture("metal.jpg")
EntityTexture cage,metal


;The start of a castle

strtwall1=LoadMesh("wall_1.3ds")
walltex=LoadTexture("gothic3.jpg")
EntityTexture strtwall1,walltex
PositionEntity strtwall1,-10,10,263
ScaleEntity strtwall1,.5,.5,.5
RotateEntity strtwall1,-90,0,0
EntityType strtwall1,Obstacle



;The red car
VEHICLE1=LoadMesh("f360.3ds")
Cartex=LoadTexture("fskin.jpg")
EntityTexture VEHICLE1,Cartex
PositionEntity VEHICLE1,-22,6,202
ScaleEntity VEHICLE1,2,2,2
EntityRadius VEHICLE1,.2
EntityType VEHICLE1,Car

;Weapon shop
weapshop=LoadMesh("weapshop.3ds")
weapshoptex=LoadTexture("weapshop.jpg")
EntityTexture weapshop,weapshoptex
PositionEntity weapshop,-59,12.5,178
RotateEntity weapshop,0,90,0
ScaleEntity weapshop,.5,.5,.5
EntityType weapshop,Obstacle
;weapon shop owner
wso=LoadAnimMesh("dwarf1.b3d")
wsotex=LoadTexture("dwarf.jpg")
EntityTexture wso,wsotex
PositionEntity wso,EntityX(weapshop)+1.5,6,EntityZ(weapshop)-2
ScaleEntity wso,.085,.085,.085
EntityType wso,Player
RotateEntity wso,0,-90,0
EntityRadius wso,.2

; shop
shop=LoadMesh("shop.3ds")
shoptex=LoadTexture("shop.jpg")
EntityTexture shop,shoptex
PositionEntity shop,-30,12.5,174
RotateEntity shop,0,270,0
ScaleEntity shop,.5,.5,.5
EntityType shop,Obstacle



;Creating the sky
sky = CreateSphere(60)
FlipMesh sky
ScaleEntity sky,700,700,700
PositionEntity sky, 0,70,0
sky_tex = LoadTexture ( "sky.bmp" )
EntityTexture sky,sky_tex
EntityParent sky,char



;Making water
water_tex=LoadTexture( "water1.jpg" )
ScaleTexture water_tex,6,6
water=CreatePlane()
EntityTexture water,water_tex
PositionEntity water,0,2,0
EntityAlpha water,.5
ScaleEntity water,5,100,5



;loading the terrain
terrain=LoadTerrain ( "HMAP.jpg" )
ScaleEntity terrain,5,100,5
PositionEntity terrain,-758,-21.7,-500
tex=LoadTexture( "GRASS1.jpg" )
EntityTexture terrain,tex 
EntityType terrain,Ground




;Animation extracting
;run
ExtractAnimSeq(char,16,26)

;idle
ExtractAnimSeq (char,292,325)


idle=ExtractAnimSeq (wso,292,325)

;attack
at1=ExtractAnimSeq (char,62,180)


;-----------------------------------------------------------------------------------------------------
;-----------------------------------------------------------------------------------------------------
While Not KeyDown( 1 )

If Not Animating( wso )
		Animate wso,1,.2,idle,1
	EndIf


If EntityDistance (char,VEHICLE1)<1 And KeyHit(32) Then 
EntityParent char,VEHICLE1
HideEntity char
End If 





;Jump
If KeyHit( 57 )=True Then TranslateEntity char,0,9,0

;speed boost
If KeyDown( 16 )=True Then MoveEntity char,0,0,9

; Turn Left and Right
If KeyDown( 203 )=True Then TurnEntity char,0,2,0
If KeyDown( 205 )=True Then TurnEntity char,0,-2,0

;move character forward and animate
If KeyDown(200)
  MoveEntity char,0,0,.3
  If AnimSeq( char )<>1 Animate char,1,.2,1,1  
  Else
  If AnimSeq( char )<>2 Animate char,1,.2,2,1
End If


;move character backward
If KeyDown(208)=True Then MoveEntity char,0,0,-.08

;strafe left x
If KeyDown( 44 )=True Then MoveEntity char,-.5,0,0
;strafe
If KeyDown( 45 )=True Then MoveEntity char,.5,0,0

;Gravity
TranslateEntity char, 0,-0.5,0
TranslateEntity wso, 0,-0.5,0
TranslateEntity VEHICLE1, 0,-0.5,0



;COLLISIONS
Collisions Player,Obstacle,2,2
Collisions Obstacle,Player,2,2
Collisions Ground,Player,2,3
Collisions Player,Ground,2,3
Collisions Player,Car,2,3
Collisions Car,Player,2,3
Collisions Car,Ground,2,3
Collisions Ground,Car,2,3




UpdateWorld




RenderWorld
Text 30,30,"Your location: x= "+EntityX(char)+" y= "+EntityY(char)+" z= "+EntityZ(char) 
Text 30,50,"Hit escape to exit"


Flip
Wend
End   


FreeEntity char
FreeEntity wso 


Edit: I changed the <1 to <5, and when I went inside the car, (screwed up collision, will fix) and pressed 'd' like 5 times it screwed up the text in the top left hand of the screem? Why?



Well, I just had a quick look but this:

Collisions Player,Obstacle,2,2
Collisions Obstacle,Player,2,2
Collisions Ground,Player,2,3
Collisions Player,Ground,2,3
Collisions Player,Car,2,3
Collisions Car,Player,2,3
Collisions Car,Ground,2,3
Collisions Ground,Car,2,3


should NOT be in your main loop. You just declare it ONCE, and it will work until you call clearcollisions or something.

SLotman is right, you shouldn't be doing that. Also, you should try and make your variables global.

<img src="http://blitz3dstuff.googlepages.com/untitled.JPG">


Does that even compile? Seems like Web Browser code.

Try throwing in a cls at the top of your loop. Shouldn't really do anything as renderworld should overwrite the whole screen.

You should try stripping your code down o the very basics of what you need to make it work. You don't need the weapons shop or anything like that :o)

I love Blitz - where else could you find someone trying to get a dwarf to drive a ferrari?

Ross c
I have no clue how that html got in there, I have been doing that lately too, so, it was probably on my clipboard...

Puki, I try to do new things. I have an animated horse model to, but I thought a ferrari would be cooler. It is just for fun and to learn, so I figured that I could do what I wnat

I decided to get back to this project as i did not ever figure out how to get that code to work. I noticed something when going back through, the collisions for the car only work on the top of the car (if i jump up on top i dont fall through) but it lets me walk right through the side of the car except for the wheels what the heck

No matter what mesh i try to hide with hideentity, it always freezes the game, and screws of the lettering, and does not hide anything.

@puki
Speaking of a dwarf in a Ferrari...uh.on second thought, better not. Never mind.

Got some advice?

did you mention you were having trouble with moving once you were in the car?

no, i got the moving down, but here are my problems:

The collision only works on the wheels, and the top of the cars (got another one, both from psionic)

and, hideentity will not work, it always screws up the text , (view picture) and it makes the game freeze, and it does not hide anything, and

I cannot get the camera to rotate on the x (does pointentity camera, do this maybe?

also, when i drive over something bumpy, the character seperates from the car even though it is parented to the car.

Do you want me to submit some more recent code?

Instead of hiding the entity, can't you just unload it (FreeEntity)?

And when you have your character parented to the car, you can remove the collision-type from your character and just keep the collisions on your car.
That way your character doesn't bump into obstacles ( since it doesn't have collisions anymore) and will stay in place.

is that what it would be?


Collisions Ground,Player,2,3=false
Collisions Player,Ground,2,3=false

do the cars have bottoms?

Can't you just parent the dwarf to the car, and then hide it. Then just move the car?

Can you post the put a file with your code and all the media up and i'll have a look see.


is that what it would be?


Collisions Ground,Player,2,3=false
Collisions Player,Ground,2,3=false



To remove collisions from an entity, set it's entitytype to 0, then no collision-checking will take place (see documentation about EntityType).
When the player gets out of the car, re-initialize the EntityType of the player (EntityType char,Player).

All right, here is the file Click this

The collision only working on the wheels may be because the model isn't made into one group. If it isn't, Blitz might treat each group as a separate entity.

Though I'm not certain what is screwing up the text, it might be fixed by clearing the screen at some point in the main loop, maybe after the Flip command.

You might be able to do away with the problems with HideEntity by clearing the collisions for the dwarf and setting his alpha to zero while he is in the car. But I haven't tested this yet.

OK, this is a REAL wild guess, but the problems your having with the camera's rotation and with the messed up text may be related. I don't use parents very much because of the problems I have using them. I usually set the child's position to that of the parent and then move and rotate it to the position and direction I want. I've noticed that sometimes when a parent isn't moving the child will resist moving and also give strange position and orientation results.

Ok, i have had a look at this.

Firstly, your jeep and car are made out of many parts. They aren't centred either, so this is causing some collision issues. When using entitytype, using the recursive flag so it sets all parts to have collisions.

Same problem with your shop i believe

For some reason your camera was pointing downwards?

Try and give all your extracted animations a variable assignment. Makes it easier to keep track of whats what :o)

Indent your code better. Every IF statements contents should probably be indented by al least a tab. Keeps it consistant and easily readable.

Make your variables GLOBAL if you intend to use them throughout your code. If you add functions to that code, many of your variable setting would be over written, or worse, shared.

I shared your problem with hideentity. Not sure what that was about, but i buggered something up. Problably a variable problem.

I implemented a better camera system, one that doesn't rely on setting up a parent. You simply pass across the entity you want the camera to follow every frame. You can change entities and it will smoothly translate.

You need to put your vehicles into a type collection, or array system (Types are easier to read). Reason being, you have hardcoded variable names and don't really know how many vehicles you have, or have any easy way of individually checking them. I have implemented a type system to hold your cars. When the SPACEBAR is pressed, it does a distance check against all the cars and returns the closest car. You simply do a distance check against the returned entity to see if it is in range or not.

I put alot of stuff into functions to ease reading and enable you to see whats going on better.

I think that's all. I completely rewrote your code too, sorry about that, but it's easier for me to do that than try and modify yours :o) I haven't commented everything, just the things i have really changed.

Oh, i added a speed variable to your vehicles, so they accelerate and decelerate. Pretty basic stuff. Just to get you started.

; Game
; ---------------------
AppTitle "Game"
Graphics3D 1024,768,32,2
SetBuffer BackBuffer()

;Collision Group
Global Player=1
Global Obstacle=2
Global Ground=3
Global Car=4


;The controlable Character
Global char=LoadAnimMesh("dwarf2.b3d")
Global chartex=LoadTexture("dwarf2.jpg")
PositionEntity char,-38,19,202
ScaleEntity char,.085,.085,.085
EntityType char,Player
EntityRadius char,1


;Camera
Global cam1=CreateCamera()
PositionEntity cam1,EntityX(char),EntityY(char)+4.5,EntityZ(char)-7


Global cam_piv = CreatePivot()
Global cam_target = CreatePivot()
Global cam_target_chase = CreatePivot()
EntityParent cam_piv,cam_target
PositionEntity cam_piv,0,8,-6

; The below values: The lower they are, the fast the camera will react.
Global chase_target_speed# = 20 ; the speed the camera pivot will catch up with the current camera target
Global chase_speed# = 30 ; the speed the camera will catch up with the camera pivot

;Light
lite1=CreateLight(1)
RotateEntity lite1,90,0,0


;Tree2
tree2=LoadMesh("Tree1.3ds")
PositionEntity tree2, -20,5,116
ScaleEntity tree2,.05,.05,.05
EntityType tree2,Obstacle
;cage
cage=LoadMesh("thecage.3ds")
ScaleEntity cage,.040,.040,.040
PositionEntity cage,EntityX(tree2)+4,EntityY(tree2)+1.2,EntityZ(tree2)-2
Global metal=LoadTexture("metal.jpg")
EntityTexture cage,metal




Type vehicle
	Field entity
	Field speed#
End Type

;The red car
v.vehicle = New vehicle
	v\entity = LoadMesh("f360.3ds")
	Cartex = LoadTexture("fskin.jpg")
	EntityTexture v\entity,Cartex
	PositionEntity v\entity,-41,7,175
	EntityRadius v\entity,1
	EntityType v\entity,Car,True
	RotateEntity v\entity,0,35,0
	; centre the mesh to the 0,0,0 axis
	FitMesh v\entity,-MeshWidth(v\entity)/2,-MeshHeight(v\entity)/2,-MeshDepth(v\entity)/2,MeshWidth(v\entity),MeshHeight(v\entity),MeshDepth(v\entity)
	ScaleEntity v\entity,2,2,2

;The green jeep
v.vehicle = New vehicle

	v\entity = LoadMesh("jeep1.3ds")
	jeep1tex = LoadTexture("jeep1.jpg")
	EntityTexture v\entity,jeep1tex
	PositionEntity v\entity,-67,8,200
	EntityType v\entity,car,True
	EntityRadius v\entity,1
	; centre the mesh to the 0,0,0 axis
	FitMesh v\entity,-MeshWidth(v\entity)/2,-MeshHeight(v\entity)/2,-MeshDepth(v\entity)/2,MeshWidth(v\entity),MeshHeight(v\entity),MeshDepth(v\entity)
	ScaleEntity v\entity,0.8,0.8,0.8

;Weapon shop
weapshop=LoadMesh("weapshop.3ds")
weapshoptex=LoadTexture("weapshop.jpg")
EntityTexture weapshop,weapshoptex
PositionEntity weapshop,-59,12.5,178
RotateEntity weapshop,0,90,0
ScaleEntity weapshop,.5,.5,.5
EntityType weapshop,Obstacle

;weapon shop owner
wso=LoadAnimMesh("dwarf1.b3d")
wsotex=LoadTexture("dwarf.jpg")
EntityTexture wso,wsotex
PositionEntity wso,EntityX(weapshop)+1.5,6,EntityZ(weapshop)-2
ScaleEntity wso,.085,.085,.085
EntityType wso,Player
RotateEntity wso,0,-90,0
EntityRadius wso,.2

; shop
shop=LoadMesh("shop.3ds")
shoptex=LoadTexture("shop.jpg")
EntityTexture shop,shoptex
PositionEntity shop,-30,12.5,174
RotateMesh shop,0,270,0
ScaleMesh shop,.5,.5,.5
EntityType shop,Obstacle



;Creating the sky
sky = CreateSphere(60)
FlipMesh sky
ScaleEntity sky,700,700,700
PositionEntity sky, 0,70,0
sky_tex = LoadTexture ( "sky.bmp" )
EntityTexture sky,sky_tex
;EntityParent sky,char


;Making water
water_tex=LoadTexture( "water1.jpg" )
ScaleTexture water_tex,6,6
water=CreatePlane()
EntityTexture water,water_tex
PositionEntity water,0,2,0
EntityAlpha water,.5
ScaleEntity water,5,100,5




;loading the terrain
terrain=LoadTerrain ( "HMAP.jpg" )
ScaleEntity terrain,5,100,5
PositionEntity terrain,-758,-21.7,-500
tex=LoadTexture( "GRASS1.jpg" )
EntityTexture terrain,tex 
EntityType terrain,Ground


;Animation extracting
;run
Global char_run_anim = ExtractAnimSeq(char,16,26)

;idle
Global char_idle_anim = ExtractAnimSeq (char,292,325)

;attack
Global char_attack_anim = ExtractAnimSeq (char,62,180)


Global shopkeeper_idle_anim = ExtractAnimSeq (wso,292,325)





Global mode = 0 ; 0 = Control Character
				; 1 = Control Car

				
Global entry_distance = 8 ; the distance you need to be to enter a car.
				
Global nearest_vehicle ; the vehicle you are nearest too
Global driving_vehicle ; the vehicle you are in control of. Set to null if none.

Global drive_speed# = 0 ; the speed the car travels at

Collisions 1,2,2,2
Collisions 1,3,2,2
Collisions 1,4,2,2


While Not KeyHit(1)


	check_mode_control() ; check to see if the SPACEBAR has been pushed to drive a car or exit one.

	If mode = 0 Then
			character_control()
	ElseIf mode = 1 Then
			vehicle_controls()
	End If
	

	; slow down the car speed regardless of if the player is in it, or has ever been in it. This is so if the player
	; jumps out at speed, the car keeps on going but slows down.
	If drive_speed > 0.01 Then ; if the cars speed is greater than zero, slow it down
		drive_speed = drive_speed - 0.02
		If drive_speed < 0 Then drive_speed = 0 ; if it slows down to below zero, set to 0
	ElseIf drive_speed < -0.01 Then ; if the cars speed is less than zero, speed it up
		drive_speed = drive_speed + 0.02
		If drive_speed > 0 Then drive_speed = 0 ; as above
	Else
		drive_speed = 0
	End If

	; only attempt to move the actual vehicle if it has been driven once. Else the variable holding the driven car
	; be set to zero, and it will generate an error.
	If driving_vehicle <> 0 Then
		;DebugLog(" driving vehicle = "+driving_vehicle+" speed : "+drive_Speed)
		MoveEntity driving_vehicle,0,0,drive_speed
	End If
	
	UpdateWorld
	RenderWorld
	Flip
Wend
End

;This function checks the space bar to switch between character and vehicle control, by setting the mode variable.
Function check_mode_control()

	If KeyHit(57) Then
		If mode = 0 Then
			nearest_vehicle = check_nearest()
			If EntityDistance(char,nearest_vehicle) < entry_distance Then
				driving_vehicle = nearest_vehicle
				mode = 1
				EntityParent char,driving_vehicle
				HideEntity char
				DebugLog(" hiding char")
			End If
		ElseIf mode = 1 Then
			mode = 0
			ShowEntity char
			EntityParent char,0
		End If
	
	
	End If
	
End Function

; This is the function for character control
Function character_control()

	If KeyDown(200) Then
		If AnimSeq(char) <> char_run_anim Then
			Animate char,1,.2,char_run_anim,4
		Else
			MoveEntity char,0,0,0.5
		End If
	Else
		If AnimSeq(char) <> char_idle_anim Then
			Animate char,1,.2,char_idle_anim,4
		End If
	End If

	If KeyDown(203) Then RotateEntity char,EntityPitch(char,True),EntityYaw(char,True)+2,EntityRoll(char,True)
	If KeyDown(205) Then RotateEntity char,EntityPitch(char,True),EntityYaw(char,True)-2,EntityRoll(char,True)
		
	MoveEntity char,0,-2,0

	update_camera(char)

End Function
	
; This is the function for vehicle control
Function vehicle_controls()

		If KeyDown(200) And mode = 1 Then
			drive_speed = drive_speed + 0.04
			DebugLog("Moving car : "+drive_Speed)
		ElseIf KeyDown(208) Then
			drive_speed = drive_speed -0.04
		End If

		If KeyDown(203) Then RotateEntity driving_vehicle,EntityPitch(driving_vehicle,True),EntityYaw(driving_vehicle,True)+2,EntityRoll(driving_vehicle,True)
		If KeyDown(205) Then RotateEntity driving_vehicle,EntityPitch(driving_vehicle,True),EntityYaw(driving_vehicle,True)-2,EntityRoll(driving_vehicle,True)

		update_camera(driving_vehicle)

End Function		

; This function checks all vehicles and return the nearest vehicle to the player
Function check_nearest()

	Local n_vehicle = 0 ; the closest vehicle so far
	Local n_distance# = 99999999 ; the closest distance so far. Set to very high so close distance is found
	Local flag = 0 ; set to 1 when entity is found. So at the end of the function we can tell if anything was found.

	For v.vehicle = Each vehicle
	
		; check the distance between the player and the vehicle. If it's less than the smallest distance recorded,
		; then it is the nearest vehicle so far.
		If EntityDistance(char,v\entity) < n_distance Then
			n_distance = EntityDistance(char,v\entity) ; set smallest distance so far
			n_vehicle = v\entity ; set the nearest vehicle variable to the entity handle of this type object.
			flag = 1
		End If
		
	Next
	
	If flag = 1 Then ; if a vehicle was found then
		Return n_vehicle ; return the nearest vehicle
	Else
		Return 0 ; return 0 if no vehicles found
	End If
	
End Function


; smooth moving camera function. Uses 3 pivots.
; cam_target is the pivot the camera will always rest to view on. It is set to the entity you want to follow.
;                                                                 It will always match it's position and rotation
;																  without parenting to it.
;
; cam_target_chase is a pivot that constantly moves toward the target pivot above. The camera is always pointing to it
; 																				   It moves so when the target is
;																				   switched, the camera doesn't
;																				   jump to the next target.
;																				   I changed the Y position of this
;																				   pivot so to adjust the point the
;																				   camera points to, as it was too
;																				   low.
; cam_piv is a pivot that is parented to the target pivot. It never needs moved, as it is parented, and follows
;														   the target whereever it goes.
;														   The camera always moves toward it.
;														   It is the resting POSITION of the camera, so by adjusting
;														   it's position relative to the target pivot, you can,
;														   adjust the view height, and view distance.
;
; The camera itself will point towards the cam_piv, move towards it, then point to the cam_target_chase pivot.
; Since there is NO render during this point, the camera's change of view is never recorded. It's only for
; movement purposes.
Function update_camera(target)

	PositionEntity cam_target,EntityX(target,True),EntityY(target,True),EntityZ(target,True)
	RotateEntity cam_target,EntityPitch(target,True),EntityYaw(target,True),EntityRoll(target,True)
	
	PointEntity cam_target_chase,cam_target
	MoveEntity cam_target_chase,0,0,EntityDistance(cam_target_chase,cam_target)/chase_target_speed
	PositionEntity cam_target_chase,EntityX(cam_target_chase),EntityY(cam_target)+5,EntityZ(cam_target_chase)
	PointEntity cam1,cam_piv
	MoveEntity cam1,0,0,EntityDistance(cam_piv,cam1)/chase_speed
	PointEntity cam1,cam_target_chase
	
End Function


You did not have to spend that much time, thanks, ill have a look

Dang, that is better, thanks, ill study it.
No problems, except, he is kinda hovering about the ground now, Ill work on it.

I increased his entityradius, so it's probably forcing him off the ground a little. As i say, it's pretty basic as collisions and such go.