Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Baby 3D Plugin for Construct 2

Make 3D games in Construct 2 powered by Babylon.js · By Pixel Rebirth

Rays hit angle

A topic by Construct2notbadnow created 1 day ago Views: 19 Replies: 3
Viewing posts 1 to 2

hi pixel rebirth. Add rays angle hit is possible? 

Developer

If you want create a ray at a certain angle all you need to be familiar with is cos and sin and apply it.

So speaking from a topdown view having the ray at an angle of 45 degrees would be simply X vector set to cos(45) and Y vector to sin(45).

I don't think you got me right. When the beam hits, I can calculate the position of the hit, but how can I calculate the slope of the surface that the beam hit?

Developer

Just to be clear: you want to get the yaw, pitch and roll of a hit face? What's the use case if I may ask?

Afaik you could use a bit of math and get yaw and pitch of the face from the normalized normal. However the normal from the ray hit is being used internally, it's not exposed via expressions or anything currently. 

Maybe such expressions could be useful.