Godot: Why raycasts are disabled by default?

Created on 25 Aug 2019  路  7Comments  路  Source: godotengine/godot

Godot version:
89bcfa4

Steps to reproduce:

  1. Create a RayCast(2D) node
  2. Add some code and stuff
  3. Try it
  4. Oh, it doesn't work. You forgot that the Raycast you just wanted to use isn't enabled by default

Issue description:
Why tho? If I add a Raycast, I most likely want to use it. And raycast is supposed to be working all the time to, you know, actually detect something. Couldn't the enabled property be ON by default? Is really no one else bothered by this? >_>

breaks compat discussion physics

Most helpful comment

Newbies don't make complex games. They just need this one raycast. I can't see how it's newbie-friendly when it might cause confusion. And even if you are experienced, raycasts might catch you off-guard when you don't use them too often and you waste a minute or two.

All 7 comments

Well, if you're not careful raycasts can hog your CPU and having them disabled by default is more newbie friendly. And ticking one checkbox as you go (or adding one line of code) is not really a big deal. Also for more complex games you want to control when your raycasts happen, so it is better to keep them disabled at all times and enable when needed.

Newbies don't make complex games. They just need this one raycast. I can't see how it's newbie-friendly when it might cause confusion. And even if you are experienced, raycasts might catch you off-guard when you don't use them too often and you waste a minute or two.

Agreed, Raycasts should be on by default. Performance is really not a factor here. You can have thousands of them before you will even notice.

If anything the performance argument should be made for collision shapes. Which are drastically more expensive, but on by default. (And it would still be silly to have them off by default.)

@TheDuriel well, maybe for 2D you cah have thousands of them, but not for 3D, people have to implement raycast schedulers for well under 1000 raycasts per frame on much more mature engines, because they cost time and doing something you don't need to do at short precious frame time is a bad thing. I'd vote for status quo as it is not really big deal discussed here. I prefer my beard under blanked and you don't need to change anything. Bingo!

Yeah, they should be on by default, It's pretty annoying to have to manually activate then every time I create a new one. As TheDuriel said collision shapes are on by default, and they're more expensive than Raycasts even for 3D.

I agree RayCasts should be enabled by default as well, but this will have to wait for 4.0 as to not break existing projects.

Yes, it's probably best to enable as default.

I feel that it is more confusing for devs to add a raycast only for it not to work (as by design) than it is to add 1000 raycasts and then wonder why their game is running slowly.

Was this page helpful?
0 / 5 - 0 ratings