ResetEntity

Blitz3D Forums/Blitz3D Programming/ResetEntity

Hi there,
Do you know:
a) When we use the ResetEntity command?
b) Does this command affects the collision state of the parent entities also? [Edit: and the childs?]

Thanks

a) If you want to move an entity from one side of the level to the other (warp) without colliding it to everything in between.
b) Not sure, but I'm sure it is easy enough to test it ?

Thanks b32, but I don't know how I can do this test because I don't know what happen to an entity when you reset it and how long it takes this resetting

This is from on-line help:

'ResetEntity' is the command to use when you want to reposition a collision enabled entity without it being stopped by the first object it encounters that it is enabled to collide with.

Just use 'ResetEntity' immediately after the positioning command (it can actually be used anywhere between the positioning command and the 'UpdateWorld' command) and the collision data for the entity will be reset, fooling the collision system into thinking that the entity was already at the new position, and had not been moved.

Very useful when you want to teleport game characters and items, for example.

Barney

Here is how I would test it:

	Graphics3D 800, 600, 0, 2
	SetBuffer BackBuffer()
	
	camera = CreateCamera()
	MoveEntity camera, 0, 0, -15
	
	;create 2 attached cubes (red/green)
	cube = CreateCube()
	cube2 = CreateCube()
	EntityColor cube, 255, 0, 0
	EntityColor cube2, 0, 255, 0
	MoveEntity cube2, 2, 0, 0
	EntityParent cube2, cube
	MoveEntity cube, 5, 0, 0
	
	;create obstacle cube (white)
	cube3 = CreateCube()
	
	;set collision types
	EntityType cube, 1, 1
	EntityType cube3, 2
	
	;set collisions
	Collisions 1, 2, 2, 3
	
	Repeat
	
		MoveEntity cube, -0.1, 0, 0
		
		;comment this line to disable ResetEntity
		ResetEntity cube
	
		UpdateWorld()
		RenderWorld()
		Flip
		
	Until KeyHit(1)
	
	End

It seems that child entities are not reset. However, you could write a function that does that:
Function iResetEntity(mesh)

	ResetEntity mesh
	For i = 1 To CountChildren(mesh)
		iResetEntity GetChild(mesh, i)
	Next
	
End Function


I think Blitz3D's power lies into its community
Thank you very much!