Brush coordination for when character crashes into a collider?

Hello,
How are you? I notice how there are many games out there where if a character crashes into a wall, the character keeps on moving but brushes up against the wall. Wolfenstein 3D was the very first perfect example of what I am talking about. Using a raycast only defines a collider point, but how would I also get an extended point as to where the character should continue to move (creating a ‘brush-up’ effect)?

Thank you,
Michael S. Lowe

This is not explained very well as to what you want, but do detect a collision with the wall I would use

OnCollisionEnter, OnCollisionStay, OnCollisionExit, OnTriggerEnter, OnTriggerExit, OnTriggerStay


Could RaycastHit.crashPoint be another added variable to the next version of Unity (with RaycastHit.crashPoint being the next ‘brush up’ point)? In many games, the characters don’t just hit a wall from an angle and then stop. In “Descent”, the game even brushes against walls in 3D. How would I do something similar to this in 3D?

Hmm im not totally sure how to acheive this with a raycast or but my thoery although complex would be:
Fire raycast and dectect the wall, use the hit info to spawn an empty gameobject.
Have the gameobject use Vector3.Angle to detect its angle compared to the wall, then fire a second raycast along the wall some distance. This gameobject could then return the hit info from the second raycast to the original gameobject.

If thousands of games have this algorithm, why does it seem next to impossible to develop a Unity game that also has this algorithm? Wouldn’t it make sense to develop a function that calculates something like this (to make game developing much easier)? If anyone knows of something similar to this, please let me know.

… nothing so far huh?

Thank you RoryScanIan, but what if the collider that I hit (for my second raycast) is not a perfect cube? Wouldn’t this method only work for cubes? How do the other 3D games out there do THEIR method of sliding against colliders (instead of just hitting them and stopping regardless of the angle)?

These games out there do precision collision movements for more than just cubes, but also things like rocks, which can be of several organic shapes. How do they do that? I want to use Raycasts for my calculations since I’ve noticed that physics seem to slow down my game.

Look up the CharacterController, it does what you want automatically behind the scenes, although with limited flexibility.

Thank you. I tried that but I don’t want to use Physics. I want to use Raycasts instead because it only seems to slow down the program, and it is less smooth whenever I use the character controller. I also already have some objects in my game where the physics behind the character controller collides with the colliders that I am wanting to use Raycasts against instead.