Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make raycasts support collision boxes as well #12673

Open
Wuzzy2 opened this issue Aug 9, 2022 · 5 comments
Open

Make raycasts support collision boxes as well #12673

Wuzzy2 opened this issue Aug 9, 2022 · 5 comments
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API

Comments

@Wuzzy2
Copy link
Contributor

Wuzzy2 commented Aug 9, 2022

Problem

Currently, raycasts can only "collide" with selection boxes but not collision boxes.

Solutions

Add a new parameter or parameters to the raycast functions to control which type of "boxes" the raycast collides with (so: selection box only, collision box only, or both).

Background

I noticed this limitation when I was reworking the parachute in Repixture. I use raycasts to predict whether the parachute object would collide with anything before actually spawning it. This works for most nodes but it fails for fences which have an overhigh collision box (1.5 nodes high) but a smaller selection box (1 node high).

@Wuzzy2 Wuzzy2 added Feature request Issues that request the addition or enhancement of a feature @ Script API labels Aug 9, 2022
@appgurueu
Copy link
Contributor

appgurueu commented Aug 9, 2022

I use raycasts to predict whether the parachute object would collide with anything before actually spawning it.

What you actually want is checking whether a box would collide with any other boxes which is exactly what https://github.com/appgurueu/disable_build_where_they_stand/blob/master/init.lua does using only Lua; it was quite a hassle to implement (I had to implement all possible node collisionbox types, but that code resides on modlib, keeping dbwts simple).

@sfan5
Copy link
Member

sfan5 commented Aug 9, 2022

Like appguru said instead of extending raycasts to do this what you really want is pretty much invoking the engine's collision detection once, basically calling collisionMoveSimple.

@Wuzzy2
Copy link
Contributor Author

Wuzzy2 commented Aug 12, 2022

Ignoring my specific use case, is this feature request OK? If not, close.

@Desour
Copy link
Member

Desour commented Aug 12, 2022

There are other use-cases for this than parachutes.
I.e. if I want to make an arrow, or some other projectile, I'd want to do a small raycast in each server-step, from old pos to new pos. This should use collision boxes.
Edit: Also: beam weapons obviously. pew pew

@sfan5
Copy link
Member

sfan5 commented Aug 12, 2022

I'd want to do a small raycast in each server-step, from old pos to new pos.

This is exactly what collision detection does, we should be exposing that.

beam weapons obviously. pew pew

technically this is an usecase for an infinitely small beam but also collision detection can cover this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API
Projects
None yet
Development

No branches or pull requests

4 participants