Hi i’m creating a blackhole that sucks an type of characters.
I’m doing something like this:
That’s my blackhole class, i’m only want to suck my characters.
That works perfectly if i turn on physics simulate on my character capsule component, but then i can’t move…
And if i turn physics simulate on mesh i get some errors like the follows:
I tested using mesh component, but nothing happens, what is the way to do that?
THX in advance, sorry about my english!
I add some screens of my mesh and capsule settings
Can you give me some example about add relative location? I don’t want to be something like instant teleport, i want something smooth like apply force to an object.
That’s exactly what i need, really thx Flame!
Physics such as impulse/force usually dont go very well with actors with character movement compoenent. Because you want your character movement component to handle the movement, instead of physics. (For example, you dont want your character rolling or tipping over, usually).
I dont know if this is how you are supposed to do this, but when i need to apply force to a character, i instead use “Launch Character” from the movement component.
If you want it to be like the black hole is constantly sucking the player, you can just add relative location towards the black hole too.
Sure thing, but i usually use blueprints, so, sorry from the start.
What i would do in your case is below. Basically, i create a function that finds a vector from player to blackhole, and divide it by that vectors length to get unit vector in that direction. Next, multiply it by pull force and add it as relative position.
For example if you want to make the pull get even more stronger when you are closer, you can change the vectorlength with “vectorlengthsquared”. So if the distance is greater, delta location will be smaller.
After you implement this graph as a function or event, you can then “SetTimerByEvent” or “SetTimerByFunctionName”.
After this, if you feel like your character is not sliding towards the blackhole, but gradually teleporting towards it, divide both the pull force constant and the timers delta time by 10, it should smooth it out, while keeping the same movement speed towards the blackhole.
You are welcome, good luck on your game!