Download

Attached object physics and collision

I have this part that attaches an obejct when press E and when i am overlaping with a colision box of that same object, In fact it does attach and i can move to the sides and back and the object follows the player but if i move forward the player cant move because colides with that object

then i enable that object physics on overlap and now i can move the object forward BUT i cannot attach the obect to the player when i enable physics therefor i cannot grab and move the object backwards or to the side:

How can i attach an object to the player and still be able to move forward? I need to have the collisions enable so i can use the overlap system and so the object dont go through walls and such

Also this is how i get the attachable object:


Find nearest Actor function:

i found out that if i want to move the object and if i use attach or deattach on the object, which is a physics asset. It makes my object disappear and not be rendered any more. If i use the function in scene file with the this->GetBallMesh()->SetRelativeLocation(BallsDirection, false, nullptr, ETeleportType::TeleportPhysics);//need to teleport it there
Then i can move it np. Also the object does not disappear. Also on your object it collides with, that object must have it set to block all dynamics and set the per poly collision to true then it will block the physics object nicely. The physics object collision set to physic actors.

I dont think its the solution for my problem since my attachable object doesnt disapear it simply doesnt attach to player if i enable physics. What is was looking for was a way to maybe disable mesh colision to player while maintaining the collisions for the all other objects, and also maintaing the box collider colision to player so the overlap system can work

ah your doing it on the player. That is probably different then what i was doing then. I was after making a ball go a round and that is what i found in the process of getting it to work. Thought it might help you but sounds like not.

Good luck with what your doing you will solve it.

1 Like

You need to create a new collision type for the CMC collision component. Then apply it to your pawns collision component. After which you have attached objects Ignore or Overlap that collision type.

Example: https://i.imgur.com/yOD4VOe.jpg
Here I have a custom “PawnCapsule” Object type that is set to “Ignore” projectiles. Doing so allows the projectile to hit the skeletal mesh, thus enabling me to get hit bone for custom damage application.

To ignore the player character should i select the “ignore-pawn” checkbox?
And what node should i use to change the collision preset on the blueprint? for example i want to set custom preset when i press E and set “blockalldynamics” when i release E

if u use the attach function. the object will still go through walls even if it has collision on.
if you don’t want the object to go through walls u need to use a physics handle so that its still simulating physics while its picked up

Can you show me how please? im very noob in this collision things

i have done this but when i use it the object doesnt attach:

in your pawns collision cylinder.
this isfrom the older version so i do not know if it will work but, this was from our last game in udk so they might changed the name in newer engine of the var.

BlockZeroExtent=false//keeps paintballs from colliding into collision cylinder

Need more insight into exactly what you are trying to do. End result would be prime.

For example are you trying to attach a weapon to a characters body. Say gun in hand. Or a ball in hand?
Or are you trying to do more of a pickup/drop object that never actually touches the character. Like a VR world interaction? Object grabbed etc floats in front of the player/camera.

For actual attachment to pawn (weapons etc) you want to go the collision route I posted previously. Any actor “attached” to the skeletal mesh cannot have collision with the cmc collision component.

For the VR style floating approach you need to use a physics handle.

Imagine its a box (its a couch actually) and i want do pull and push that object when i press E, so i attach the box to the player and detach on release, at the moment im able to move to any direction (i fixed the problem i had before where i coudnt move forward) but when im grabing the box the box doesnt collide with anything and i wanted to stop when colliding with any abject beside player character right now it just ignores and overlaps all objects in scene but once i realease that box collisions are enabled

use a physics handle. Loads of tutorials on it.

1 Like

Ok thanks i didnt know what to search for