# Cancelling out scaling after z/depth position change

This topic is 4708 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey guys, I have two objects moving with each other, 1 "random" object and 1 sphere around that object. When I move the objects in Z (depth) I want the random object to scale as normal but I want the sphere around it to stay the same size as it was before. How would I go about this?, I tried projecting the pivot point of the object into screenspace and use the projected Z value as a scaling factor to cancel out the scaling on the sphere but that doesnt seem to work. (the sphere is actually a gimble like thingy as found in a modeller) How to go about this correctly? (using direct3d)

##### Share on other sites
Btw I cancelled the scale of the world-matrix, I want to cancel out the scaling effect of the view/projection matrix by scaling the former worldmatrix (negative)

Any ideas?

##### Share on other sites
Wouldn't scaling the radius of the sphere by its distance from the camera do what you need? In other words,
    sphere.radius = RADIUS_AT_ONE * Distance( sphere.center, camera.position );
or even better:
    sphere.radius = RADIUS_AT_ONE * Dot( sphere.center - camera.position, camera.lookat );

• 18
• 11
• 16
• 9
• 51
• ### Forum Statistics

• Total Topics
631396
• Total Posts
2999789
×