Issue with pre-scaled object as camera parent
Blitz3D Forums/Blitz3D Programming/Issue with pre-scaled object as camera parent
| ||
When I use a pre-scaled object as a parent for a camera, why does it affect the perspective? Here is an example:Graphics3D 640,480,16,2 SetBuffer BackBuffer() cam = CreateCamera() PositionEntity cam, 1, 5, -4 RotateEntity cam, 50, 0, 0 box = CreateCube() ball = CreateSphere() PositionEntity ball, 3, 0, 0 ScaleEntity ball, .25, 1, .25 EntityParent box, ball ;EntityParent cam, ball While Not KeyDown( 1 ) RenderWorld Flip Wend End If you run the code, notice that the box is being parented by the scaled ball, and it's dimensions are not affected in anyway. However, if you uncomment the entityparent line with the camera, suddenly the camera perspective is affected by the scaling on the parent object. Can anyone explain this? |
| ||
Try turning the box. Entity Scaling is inherited from the parent. Scaling the mesh of the ball using scalemesh might be what you are after. |
| ||
I had a similar problem, I ended up creating another pivot and then parenting both the scaled mesh and the camera to it to avoid the camera getting scaled. |
| ||
Graphics3D 640,480,16,2 SetBuffer BackBuffer() cam = CreateCamera() PositionEntity cam, 1, 5, -4 RotateEntity cam, 50, 0, 0 box = CreateCube() ball = CreateSphere() ScaleEntity ball, .25, 1, .25 cball=Copyentity (ball) PositionEntity cball, 3, 0, 0 EntityParent box, cball EntityParent cam, cball While Not KeyDown( 1 ) RenderWorld Flip Wend End Just curious, and I cannot test this myself at the mo... does this still have the same effect? or even CopyMesh... |
| ||
@DJWoodgate: Thanks for the clarification, I was confused by the apparent discrepancy in behaviour. It didn't occur to me while comparing that the box wasn't being rotated. @Shambler: Your solution is good enough for me. I had already tried adding a pivot as a buffer between the object and camera, but encountered the same problem. @Malice: Good question, but since I'm at work I can't test it either :) |
| ||
Just tried it - CopyEntity had the same effect. CopyMesh, however didn't - any use to you? |