Sprites doubling in size for no apparent reason

Blitz3D Forums/Blitz3D Programming/Sprites doubling in size for no apparent reason

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

(Hope this makes sense -- clinically brain dead right now, so it might all be misinterpreted gibberish...)

I'd say that when the new camera is created as a child of parentent1 it has the 'normal' scale, but when created as a child of parentent2, which is scaled to 3, 3, 3, it's adopting that scaling, which is correct behaviour -- it's using the scale of its local space, which for any entity is defined by its parent. I think the sprite is affected differently because they use a different scaling system (ie. ScaleSprite) tied to the current camera.

I noticed that in the "Select whichcamera" part you are freeing the camera, then creating a new camera with no handle, then calling PositionEntity on the freed camera handle -- this looks like a Blitz bug since it's not pointing to any camera, or not supposed to be! Same thing when it comes back round to freeing the camera again... PositionEntity at least should crash/give debug error!

Anyway, if you just re-parent the existing camera, there's no scaling of the sprite:

Graphics3D 640,480,16,0

;load a sprite. I tested this with a sprite 128 x 128.
sprt = LoadSprite("sprite1.jpg")
PositionEntity sprt,-8,0,10

;Creat a mesh
mesh = CreateSphere()
PositionEntity mesh,8,0,10

;create 2 meshes, side by side, to act as parents. Within a game these could be spaceships, characters,
;vehicles etc.
parentent1 = CreateCube()
parentent2 = CreateCube()
PositionEntity parentent1,5,0,-50
PositionEntity parentent2,-5,0,-50

;Scale one of the parent entities.
ScaleEntity parentent2,3,3,3

;create a camera.
camera = CreateCamera(parentent1)
PositionEntity camera,0,0,0
PointEntity camera,sprt

While Not KeyDown(1)
	;Hit the space bar to change cameras. Notice how the sprite changes in size!!
	;The mesh does not.
	If KeyHit(57)
		whichcamera% = -1-whichcamera%
		;FreeEntity camera
		Select whichcamera%
			Case 0 
				EntityParent(camera, parentent1)
			Case -1
				EntityParent(camera, parentent2)
		End Select
		PositionEntity camera,0,0,0
		PointEntity camera,sprt
	End If
	RenderWorld
	Text 320,10,"Press SPACE to change cameras.",True,True
	Flip
Wend
End


Not sure if this covers what you're trying to do, or why it's different for a new camera as opposed to using the same one -- might also be something to do with new cameras having scale reset?