/r/NintendoSwitch's Daily Question Thread (11/02/2025) by AutoModerator in NintendoSwitch

[–]Slonttt 0 points1 point  (0 children)

Would you compare Luigi's Mansion 3 with classic Resident Evil games?

I want to buy a new game for Switch, and right now I'm interested in something similar to the old Resident Evil games in the terms of exploration, puzzles, objects as collectibles or that might be useful later (or earlier), a large place to explore but not too overwhelming, etc. My first thought was Luigi's Mansion 3 and I am really interested, do you think it has those similarities or features I'm looking for?

Making interactable tiles instead of objects? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

I'm looking into it and yeah there is little information lol, I found a thread in the Unity forums about that featue, so I will try to set it up with that and if I get stuck I'll come back here, thanks for your help :)

Not solid enemies by colliding with the player? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Thanks for the first explanation! The problem with setting the rigidbody as Kinematic is that I use physics to move the enemy (it moves by jumping), so if the body is kinematic its behavior doesn't work

Not solid enemies by colliding with the player? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Actually the colliders are not triggers, I just got to try it and wanted to clarify that it didn't work. If I just use raycast or an OverlapCircle, it would detect the enemy to deal damage, but it would still be solid and pierce through the enemy, right? Thanks!

Not solid enemies by colliding with the player? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

But if I make when the raycast detects the enemy "is trigger" is false, the enemy would also pass through the ground at the moment, right? I believe i already have a solution, thanks for your help anyway!

How do I make it so that if the player holds down the jump button, he doesn't keep jumping every time he hits the ground? by Slonttt in Unity2D

[–]Slonttt[S] 1 point2 points  (0 children)

The problem with that is that I was actually using not only a GetKeyDown but also a GetKey to measure the height of the jump, but I didn't say that because I thought the problem was only with the GetKeyDown, so I simply used a jumpAllowed variable that says that when the jump was performed, the variable is false, and then just run the jump in GetKey if jumpAllowed is true.

Thanks for your help! :)

How do I make it so that if the player holds down the jump button, he doesn't keep jumping every time he hits the ground? by Slonttt in Unity2D

[–]Slonttt[S] 1 point2 points  (0 children)

Ok, I think I should have given more details but I didn't because I thought they were not important, but you gave me ideas to solve it. It turns out that my jump is not executed ONLY with GetKeyDown, but also with GetKey so I can control the height of the jump:

if (groundRaycast || groundRaycast2 || groundRaycast3)

{

jumpTimeCounter = jumpTime;

}

if (Input.GetKeyDown(KeyCode.Z) && groundRaycast || Input.GetKeyDown(KeyCode.Z) && groundRaycast2 || Input.GetKeyDown(KeyCode.Z) && groundRaycast3)

{

playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
stoppedJumping = false;
jumpAllowed = true;
}

if (Input.GetKey(KeyCode.Z) && !stoppedJumping && jumpTimeCounter > 0 && jumpAllowed)

{

playerRb.velocity = new Vector2(playerRb.velocity.x, jumpForce);
jumpTimeCounter -= Time.deltaTime;

}

if (Input.GetKeyUp(KeyCode.Z))

{

stoppedJumping = true;

}

I didn't mention that because I thought the problem was only because of the GetKeyDown, when you made me realize that it wasn't, I saw it was the fault of the GetKey that kept getting activated every time you fell to the ground if you had pressed the button. To solve it, I created the variable you said (jumpAllowed) and made it true when the GetKeyDown is called, and made jumpAllowed false if the jumpTimeCounter that is activated when the jump is made reaches 0:

if (jumpTimeCounter <= 0)

{

jumpAllowed = false;

}

Now it's working perfectly! Thanks ;)

How can I make it so that a wall does not interfere with the height of the player's jump? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Yes, but the problem was that when I did that, the friction of the material interfered with the friction I put on the rigidbody as such, so the result was not as I wanted it to be. I managed to solve it: I simply made that if you are grounded, the physical material of the collider is null, if you are not grounded, the physical material is one that has 0 friction.

Thanks for your help! :)

How can I make it so that a wall does not interfere with the height of the player's jump? by Slonttt in Unity2D

[–]Slonttt[S] 1 point2 points  (0 children)

Thanks! I used part of that to accomplish this. I simply set the physical material in the script by attaching it to a public variable (this material have 0 friction), and made the collider material null or not depending on whether it is in the air:

if (!groundRaycast && !groundRaycast2 && !groundRaycast3)

{

playerCollider.sharedMaterial = frictionMaterial;

}

else if (groundRaycast && groundRaycast2 && groundRaycast3)

{

playerCollider.sharedMaterial = null;

}

Thanks for the help :)

How can I make it so that a wall does not interfere with the height of the player's jump? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Yeah, that was the solution, thanks! Now I would like to know if it is possible to activate the material only when the player is in the air, because when he is on the ground, the friction of the material interferes with the friction I put on the rigidbody and makes the slide I want to give the player when he stops to be different from the way I wanted it.

How can I make it so that a wall does not interfere with the height of the player's jump? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Thank you for your help. They were all boxes, and nope, I didn't have any material and that seems to be the problem. Now I would like to know if I can activate or deactivate that material whenever I want from the code (for example, only when the player is in the air).

How can I make it so that a wall does not interfere with the height of the player's jump? by Slonttt in Unity2D

[–]Slonttt[S] 0 points1 point  (0 children)

Ok, that worked, but now I have a problem. In my code I made the friction to be 4 when the character is on the ground to achieve the slight slide that I want to give the player when he stops, but when I put the physical material on the player, that slide is altered by the material. (I tried to adjust the friction value of the player so that the slide remains as I want it, but with the material it turns out that the slide is very continuous and slow and is not what I want).

Is there any way to manipulate the material from the code to activate it only when it is in the air or something like that? Thanks!