I made this ODM gear from attack on titan, and it’s working fine, but I want to add wall running when the player is on a wall. The problem is, I can’t really think of a way to go about detecting if they are touching a wall. This is what it’s like right now:
Haven’t done wall running before so someone else’s answer might be better, but here’s what I’d do:
I would fire multiple raycasts around the character (or maybe just to the left/right of them). You could also fire one downward to check if they’re mid-air.
You could probably use the extents size property to figure out how wide the character is, and fire a raycast with that length and a little more.
If the raycast result isn’t nil, then you know it hit something, so they are probably touching it. I would also check if the instance it hit is anchored, so you know they’re actually touching a wall and not a player or something.
One suggestion for the detection is to use the GetPartsInPart() method, which will return an array of parts from a specified area. With the way your sequential actions look:
Zipline key press → Get the time it takes to reach destination → Once wait time or destination is reached, get parts in area to check for wall → Climb / wall hang
The reason is because you want to minimize the usage of these types of methods, so you will have less performance issues. There can also be a way to check interruptions in-between the zip, in case your character bumps into an object along the way. You can use the same method on a heartbeat or use raycasts, or dot product, either is fine.
Adding wall running mechanics to your ODM gear in Roblox sounds like a cool idea! To detect if a player is touching a wall, you can use a combination of raycasting and collision detection. Here’s a basic outline of how you could approach it:
Raycasting: Use raycasting to check if there’s a wall in front of the player. You can cast a ray from the player’s position in the direction they’re facing and check if it hits a part tagged as a wall. If it does, you know the player is close to a wall.
Collision Detection: You can use the Humanoid’s Touched event to detect when the player’s character touches a part. Check if the part they’re touching is tagged as a wall.
Here’s a simplified example of how you might implement this:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local wallTag = "Wall" -- Replace this with the actual tag you use for walls
humanoid.Touched:Connect(function(part)
if part:IsA("Part") and part:FindFirstChild(wallTag) then
-- Player is touching a wall, you can initiate wall running mechanics here
print("Touching a wall!")
end
end)
Remember to adjust the wallTag variable to match the tag you’re using for your wall parts.
Additionally, you can implement further mechanics like checking the player’s input to determine when to initiate wall running and how to control their movement while wall running.
Keep in mind that implementing wall running can be complex depending on the level of control and interaction you want to achieve. You might need to adjust character physics, camera angles, and movement mechanics to make it feel fluid and responsive.
As you work on this feature, don’t hesitate to experiment, iterate, and playtest to fine-tune the mechanics to make them enjoyable for players. Good luck, and I hope your ODM gear and wall running mechanics turn out awesome!