How to cast_ray with latest bevy_rapier (0.29.0) #17957
-
Hello, I'm a bevy/rust newby trying to migrate a project I worked on last year from Bevy 0.13 to Bevy 0.15 with bevy_rapier3d 0.29. Rapier has apparently removed RapierContext as a resource and split it into components. In many functions in my code I was fetching the RapierContext as From the migration guides in this changelog and the rapier docs it seems like I should be able to replace to When I try that I'm told I'm told If I instead use I'm terribly confused. Can anyone tell me how to properly fetch whichever component of rapier I need to perform ray casts? Do I need to add these components to some entity first? Any help is appreciated. Edit: Sorry if any of the above are really dumb questions. I spent a few weeks learning Bevy and making a fun project last year and I'm trying to refamiliarize myself with it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Update: I've made some progress here, by bothering to notice that the rapier repo I linked above has an example of raycasting! It seems I was missing a simple However I'm not seeing an error on the I don't understand this at all and I can't find any documentation on it. The raycasting example simply feeds it
Help? |
Beta Was this translation helpful? Give feedback.
-
Another Update: |
Beta Was this translation helpful? Give feedback.
Update: I've made some progress here, by bothering to notice that the rapier repo I linked above has an example of raycasting!
It seems I was missing a simple
let context = rapier_context.single()
which is the object that contains thecast_ray()
method.However I'm not seeing an error on the
max_toi
parameter:Expected 'Real' but found 'f32'
I don't understand this at all and I can't find any documentation on it. The raycasting example simply feeds it
f32::MAX
but even with that same argument the error persists.rapier_context_systemparams.rs
does specify that argument as "Real" but I don't know how to convert to this type from f32 or why the example doesn't mention it at all.Help?