C
C#6mo ago
ULTIMA

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
ULTIMA
ULTIMAOP6mo ago
$code
MODiX
MODiX6mo ago
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/
ULTIMA
ULTIMAOP6mo ago
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!
ULTIMA
ULTIMAOP6mo ago
this is my movement code https://paste.mod.gg/rhuovacnlkzn/0
BlazeBin - rhuovacnlkzn
A tool for sharing your source code with the world!
ULTIMA
ULTIMAOP6mo ago
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
Salman
Salman6mo ago
Can you show the video of the gameplay to explain the situation better
ULTIMA
ULTIMAOP6mo ago
i dont have any screen recording software but i can screenshare in a vc if that works, i cant talk in it though
Salman
Salman6mo ago
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.
ULTIMA
ULTIMAOP6mo ago
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
Salman
Salman6mo ago
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
ULTIMA
ULTIMAOP6mo ago
oh? ok, ill try
Salman
Salman6mo ago
Also moving anything using Rigidbody isn't good for performance as well
ULTIMA
ULTIMAOP6mo ago
that would explane the horrible frame rate
Salman
Salman6mo ago
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....
Salman
Salman6mo ago
Also
Salman
Salman6mo ago
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 ·····················...
ULTIMA
ULTIMAOP6mo ago
thanks was just about to ask about first person lol i hate school pcs so much, i cant watch the video
Salman
Salman6mo ago
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
Salman
Salman6mo ago
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.
ULTIMA
ULTIMAOP6mo ago
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; } }
Want results from more Discord servers?
Add your server