Hello,
I’m currently working from a rolling template and I managed to get an AI sphere character to follow the player through the nav volume with AIMoveTo and I kinda faked the rolling part.
How can I make a Sphere that would behave with simulated physics like the Rolling ball the player but in a way to follow the player through the navmesh ?
Any help would be greatly appreciated.
Only the middle one seems to fit the bill. I want it to simulate physics. I could do without the pathfinding but it would be preferred.
I was trying to go about it by adding constant torque to the ball (still need to figure out how to limit it so it doesnt accelerate out of control) and somehow finding a vector to rotate the Yaw towards the player like a turret but had no luck so far.
Alright so I figured out the main part. I donćt know how clean this is but it works for me. I worked off of a pawn blueprint and mushed some turret and roller controls. The result is a ball with simulated physics that drives around the map always going towards the player. Don’t know if it can pathfind, probably not but that’s ok I can work around this in this project. The problem now is that the mesh is static while it moves since I have to adjust the direction of the ball towards the moving player pawn. I think I could fix this with a panner material that gets the player speed. One issue is that the UV of a sphere makes the material shrink if it pans on the right axis like it should when rolling. I could pan from left to right to avoid shrinking but then it pans on the wrong axis so I should either rotate the pawn, which it won’t let me for some reason, or adjust the axis around which it aplies torque and faces the player. I didn’t go into any of this so If anyone could point me to how to do any of these I would appreciate it. I’ll leave a screenshot of the behavior for anyone possibly looking for this in the future.
Update, this is the best I can do for now. The AI Pawn Ball rolls like it should like the rolling ball example player, with physics and all that good stuff and goes wherever the player is. The only nick is that it will go directly to the player in a straights line. If anyone would care to help me add navigating through the nav volume to this I would be thrilled. Hope someone finds this useful. Blueprint in attachment, my roll torque is 500k.
There are a few ways you could achieve this.
- You could turn the ball into a skeletal mesh & create rolling with animations then using a blend space to control the speed of the rolling.
- Work out a formula to apply negative impulses to push the ball along the calculated AI path (pretty complex)
- Fake it through SetComponentRotation & Actor Speed / Velocity . E.g if speed > 0, on tick SetComponentRotation to it’s current rotation + some. You could also use a lerp to give this smoothing.
Hope this helps!