Jump to content
  • Advertisement
Sign in to follow this  
BaSSraf

Cancelling out scaling after z/depth position change

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 ); 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!