Roblox Studio Zombie chase/kill player in specific area - roblox

How can I make my zombie only chase or kill a player when they enter a specific area then stop chasing a player when a player leaves the area? I uploaded a picture of kinda what I mean. Zombie restricted area

After a lot of research and not able to find anything I figured out a way to accomplish this....Sorta
while wait(0.15) do
local target = findNearestTorso(PositionTorso)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position)
else
script.Parent.Humanoid:MoveTo(game.Workspace.SpawnLocation2.Position)
end
PositionTorso = script.Parent.Torso.Position
end

Related

Spawning blueprint does not spawn anything (UE4)

Here's a problem: my goal is to have a ball game with obstacles. I made two obstacles (cubes with triggers) and the spawner code does not spawn them - nothing at all. It does compile without errors, but just does not work. These blueprints are part of the track class (the track the ball is on). Here is the code: (obst amount = 7 - the code before it works fine - its linked to event tick)
Here are the obstacles: (no code in them)
Here is the track:
I'm using Unreal Engine 4.26.2
If it is showing up in the outliner, but you don't see it here's what I would try.
First, unplug your X and Y location. Manually input something you know is right in front of the player.
If you can see it after that, start printing the the coordinates of the spawn location. If those look right and you can't see it still, try spawning a regular cube instead. If you could see the cube but not your obstacle, then I'd check the obstacle BP. In that case it's likely either the scale of the mesh component or it's set to be hidden in game.
Sorry I know this isn't a definitive answer, but I don't have enough reputation to comment instead.

Spritekit physics failing to detect second adjacent item

Kinda what the title says, I have a "wall" made out of multiple segments specifically for modular purposes. I have a contactTestBitmask that forces the player to stop moving in the direction of the wall once collided, but, if you slide along the wall to another segment, the player just rolls straight through it. I cannot do a collisionBitmask as the player runs fast enough to "phase" through the walls. I also cannot do collision as my camera and lighting are also dependent on the player's movement and position, and will not interfere with the walls (I think). If anyone could help point me in the right direction to allow me to make solid modular walls, I'd greatly appreciate it.
Figured out the source of my problem, contact IS happening, I just have wonky flags and the system doesn't like that. I need a contact currently happening method, I guess

Unity colliders behave in a weird and unexpected way. How to solve that?

Ok so I know it's me and not the collider that is not working but I just don't understand why. In this clip you can see me moving my mouse over the enemy ship. I continuously click, and the onClick event makes the border around the enemy ship appear: https://gyazo.com/c1379139f0fe3d22ff510a0a1b45ab96 The hitbox is just a square around the entire ship so I was inside that all the time. After I managed to click on it I can shoot it but the cannonball just goes through it: https://gyazo.com/1914faecabe9c9a36cc1f5dc2632184c Here you can also see that the ball collides with the island as it should. I can also move the enemy ship with my own ship no problem.
The only thing every enemy has in common with this bug is it ONLY happens when the ship is close to an island.
If anyone could help solving that issue Id be really glad I have run completely out of ideas :(

How to get a vector from my player's origin to the wall the player collisioned with?

I'm making a 3d fps parkour game in Unity as a school project.
I think I got most of the parkour part working but there is one big problem left.
I wanted to give player some air movement because it is much harder to reach platforms without it, but it makes the wallrunning really hard.
After player jumps to a wall, if he/she moves even just a little bit away from the wall while he is running along it, the player breaks off of the wall and starts free falling (player can move while wallrunning because he/she is practically not on the ground so the air movement kicks in).
So I thought that creating a really strong force that pushes the player to the collisioned wall should work but when I use:
other.transform.position-player.transform.position
The pushing vector I get is not the nearest point.The vector goes from my player to the center of the wall which isn't correct at all. (Since wall's center is a lot higher than player's center it creates a force that launches player upwards).
Then I tried using the collision.contacts[0].point but for some reason it didn't give me the results I wanted either. I am adding an image for you to see what the vectors looks like within game scene:
Pink capsule is the player.Gray plane is my ground and the dark brown block is my wall.The green arrow is the vector I'm trying to find.
The blue line'code:
Debug.DrawRay(rb.transform.position, collision.contacts[0].point, Color.blue,1,true);
The red line's code;
Debug.DrawRay(rb.transform.position, collision.transform.position, Color.red,1, true);
Finding the vector from player to wall would also help me to implement walljump since jumping from a should create a force that pushes player away from the wall.

Path finding on a 2d plataformer game. Making enemies jump

I am working 2D Platform running game and I am stuck at this issue, i cant figure it out how to make my enemies jump through platforms as they follow the player. I used A* path finding with a Grid graph for my flying enemy and it works just fine. But with the ground troops i don't know what to do. Any recommendations where to start and what to study? Thanks in advance
Place a Trigger (Collider) attached with the Platform at the point where you want your enemy to Act (Jump in your case). and Attach a script to your Enemy to Handle its actions whenever it enters that trigger. you can make it Jump/Fly or whatever you want to. Thumb up if its helpful :)