i need help with collision detection, i think
in my game i use a capsule collider for the player, problem is whenever the player hits a wall you can only really roll along it and it takes some work to get off the wall, anyone able to give me some advice in this? if it would help i can share my movement code.
21 Replies
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/https://paste.mod.gg/vjosmkwqovmw/0 this is the code i use to use the mouse to look around
BlazeBin - vjosmkwqovmw
A tool for sharing your source code with the world!
this is my movement code https://paste.mod.gg/rhuovacnlkzn/0
BlazeBin - rhuovacnlkzn
A tool for sharing your source code with the world!
i just use a simple capsule collider with a camera and whenever a wall is collided with, you just roll along it while struggling to escape the wall, i dont really know how to fix this, should i detach the "player" from the camera, and just make the code on the camera? i can share full code if people want to try it out fully in unity just ask
Can you show the video of the gameplay to explain the situation better
i dont have any screen recording software but i can screenshare in a vc if that works, i cant talk in it though
Are you using windows?
If yes then simply press Window + G. It'd open the Game Bar. Press the Record button and that's all.
yes, cant download anything though, school pc
oh ok
it tells me i need a new app
new app required to open ms gaming overlay
Well Gamebar comes with the windows 10 and 11 .. it shouldn't ask for anything else
Btw you are using Rigidbody for the movement. I'd recommend you using a Character Controller.
Character Controller is easier to use and setup
oh? ok, ill try
Also moving anything using Rigidbody isn't good for performance as well
that would explane the horrible frame rate
Also look at this:
https://forum.unity.com/threads/how-to-correctly-setup-3d-character-movement-in-unity.981939/
Unity Forum
Resolved - How to correctly setup 3d Character Movement in Unity?
Hey there, so I'm a fairly new user on Unity and just started to test out the engine and C#.
I have a question regarding Character Movement in Unity....
Also
Brackeys
YouTube
THIRD PERSON MOVEMENT in Unity
Let's learn how to make a solid third person controller with a moving camera!
Jason no longer offers the course mentioned in the video.
👕Get the new Brackeys Hoodie: https://lineofcode.io/
● Third person controller asset: https://assetstore.unity.com/packages/templates/systems/third-person-controller-126347?aid=1101lPGj
·····················...
Brackeys
YouTube
FIRST PERSON MOVEMENT in Unity - FPS Controller
Let's see how to get an FPS Character Controller up and running in no time!
REGISTER with APPTUTTI: https://www.apptutti.com/partners/registration.php?utm_source=brackeys&utm_medium=social&utm_campaign=brackeyssponsor1
LEARN MORE: https://www.apptutti.com/corporate/?utm_source=brackeys&utm_medium=social&utm_campaign=brackeyssponsor1
● Ultimat...
thanks
was just about to ask about first person lol
i hate school pcs so much, i cant watch the video
Now unity also provides you ready made and ready to use third person and first person controller that can be used in any kind of projects. But I'll recommend you implement one from scratch as well for learning
Use a proxy
StarterAssets - FirstPerson | Updates in new CharacterController pa...
Get the StarterAssets - FirstPerson | Updates in new CharacterController package package from Unity Technologies and speed up your game development process. Find this & other Essentials options on the Unity Asset Store.
hey so quick question about the character controller, its very nice and easy but in my game i have traps that tp the player to a set location after taking damage, but it doesnt really work with character controller, is it because its using transform.position? if (other.CompareTag("Player"))
{
player = other.GetComponent<HealthUiManager>();
if (player != null)
{
player.TakeDamage(damageAmount);
player.transform.position = respawnPosition;
}
}