Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace Results on Chaos bodies #68

Open
aetherspacemind opened this issue Apr 3, 2024 · 5 comments
Open

Trace Results on Chaos bodies #68

aetherspacemind opened this issue Apr 3, 2024 · 5 comments

Comments

@aetherspacemind
Copy link

Hello.
Any way to use a line trace to get the body index? (ie the entity index)? I can use the octree but the Fbox is a little awkward for me.

I tried to set the BodyIndex in BodyInstance so that when I use a line trace I get the body index (ie the entity index) I just get an int that = body count. That doesn't work at all obviously and I have tried a bunch of things, moving the for loop way up and poking and prodding in there.

It was mentioned that the physics here used a similar way the landscape is initialized? I'm assuming the entities are "one thing"?
I tried looking for other methods in source but I couldn't put anything together. ISM uses the BodyIndex as Instance index.

@Megafunk
Copy link
Owner

Megafunk commented Apr 6, 2024

Hmm... I think the body index is for when you trace against an ISM or a skeletal mesh component's collision to map to instances of ISM instances/bones.

The physics is similar to landscapes in that it makes the new Chaos bodies on-the-spot and by mimicking using the built in Chaos physics initialization path in our own code, rather than just using the build in stuff. I think to map from chaos hit to entity ID you could change the Userdata of the body to be the entity index?

@Gholtiy
Copy link

Gholtiy commented Apr 18, 2024

Sorry for my question in this issue, but
How i can detect collision between Chaos body and Actor? My entity have PhysicsBody trait and i trying to detect that projectile is hitting the entity, and im stuck on this:(

@aetherspacemind
Copy link
Author

Use the Octree for now, its pretty fast but lacks accuracy if the detection box is small.. I have gotten pretty far with adding the bodies to an owning component(plus an owning actor) with the index I wanted in my question.

I can post my solution here, though I am not sure what @Megafunk plans to do with his vision on the physics bodies.

@Megafunk
Copy link
Owner

Megafunk commented Apr 19, 2024

I think it's worthwhile to have actual physics collision callbacks, I think https://forums.unrealengine.com/t/chaos-contact-modification/517748 a contact modifier callback might do it? I can try something to see...

@Gholtiy
Copy link

Gholtiy commented Apr 20, 2024

Also im trying UChaosEventRelay and its looks like right way, but I have no idea how to get it to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants