CodingMadeEasy Posted June 16, 2016 Share Posted June 16, 2016 I would like to have the below effect t The problem I'm having is that the spotlight doesn't provide me with the total length of the light, so there's no way for me to calculate the measurements for the cone. Can someone please lead me in the right direction on how to get the desired effect? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 16, 2016 Share Posted June 16, 2016 Hello, I think that light.range is what you are looking for Quote Link to comment Share on other sites More sharing options...
CodingMadeEasy Posted June 16, 2016 Author Share Posted June 16, 2016 Thanks for the reply :). I have used light.range but I'm not getting the expected behaviour. Maybe I'm misunderstanding how it's to be used. When I set light.range to a certain value, I expect that the light will only travel up to that distance in world coordinates. However, when trying to visualize the cone, the light seems to traverse farther than expected. Here's a sample of what I'm talking about: http://www.babylonjs-playground.com/#VHFLM#4 Note that my math may be a little off, but I would expect the height of the cone to at least reach the sphere which it's not. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 16, 2016 Share Posted June 16, 2016 This is the correct position: http://www.babylonjs-playground.com/#VHFLM#5 You need to fix the radius computation Quote Link to comment Share on other sites More sharing options...
CodingMadeEasy Posted June 16, 2016 Author Share Posted June 16, 2016 Edit: Sorry I misread what you stated. Ok so I will fix my radius computation, but can you explain to me why my positioning was wrong? Why must we subtract half of the range in order to get the correct positioning? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 17, 2016 Share Posted June 17, 2016 Because the cylinder pivot is the center of it and not the base Quote Link to comment Share on other sites More sharing options...
CodingMadeEasy Posted June 19, 2016 Author Share Posted June 19, 2016 Ah I see. Thank you for your help. I truly appreciate it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.