x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to detect collisions of a pawn, where the rootcomponent is empty?

Hello,

im currently extending the Flying C++ example and I am currently working on my Pawn. However for some specific reasons, my plane is not located at the root, but is a child of the root. (see image)

alt text

Now I have some trouble detecting collisions. My static mesh(PlaneMesh) already has a collider. If i turn physics on for my PlaneMesh, collisions are detected, but my plane falls right from the sky ..but without my Root. And my PlaneMesh is not affected anymore by moving the root.

Then I tried replacing the Root with a UBoxComponent to activate Physics on the Box and to detect collisions. But on this version my whole UE4 crashes after ~4 sec of playing. On this setting, I also get this warning:

PIE:Warning: Warning Invalid Simulate Options: Body (MyPawn_C_2.Root0) is set to simulate physics but Collision Enabled is incompatible

So here are my questions:

  • is there another way to detect collisions? (beside having "simulate physics" activated)

  • what is the proper way if I want collision detection only on a subcomponent, but not the root of the pawn?

Thanks for the help :) Greetings.

Product Version: UE 4.11 Preview
Tags:
pic.png (299.2 kB)
more ▼

asked Feb 26 '16 at 06:45 PM in Using UE4

avatar image

smara
67 6 9 15

avatar image phoboz Feb 26 '16 at 07:14 PM

If I'm not mistaken Simulate Physics treats all elements independently, hence why the plane falls on it's own. What are your collision settings on the plane and how are you testing your collision?

avatar image smara Feb 26 '16 at 07:51 PM

Here is the C++ Code where I build my components together.

alt text

Here is my Blueprint which inherits from the C++ Code and the collision settings. (Here I only activated "Simulate physics" and "Simulation Generates Hit Events" on the root component)

alt text

Ok, I found out something weird. My current setting works now and my plane doesn't fly through my landscape anymore.

However my spawn point is at the border of my landscape and my plane is falling down (due to gravitiy) and is thus placed outside of my landscape. Then after a certain height is achieved (under landscape) the crash happens.

If I however fly over my landscape or have at least a certain height then everything is fine.

Is there another way to decect collisions without having to simulate physics?

Edit:The prints in the blueprints are not happening. (I think im logging them wrong.)

Here as well my Hit Method from my c++. I do not see logs from this function either...

alt text

c++.png (32.9 kB)
settings.png (356.1 kB)
notifyhit.png (17.9 kB)
avatar image phoboz Feb 26 '16 at 08:25 PM

Your collision is set to OverlapAllDynamic so it won't generate collision, just overlap events. Try changing it to Pawn or BlockAll.

Alternatively you can try locking your Z coord under Physics > Constraints > Lock Position. This will stop the object moving over Z axis (up/down), but that might not be what you want, depending on the situation.

avatar image phoboz Feb 26 '16 at 08:26 PM

When you change collision preset, disable Simulate Physics

avatar image smara Feb 26 '16 at 08:36 PM

thanks for the quick help, works for me now.

you're awesome :)

avatar image smara Feb 26 '16 at 09:45 PM

I have one last question though:

If I only set the collision to BlockAll it works if I do this on the root as well as on the PlaneMesh.

However if I enable Simulate Physics on the root now as well, the game crashes instantily. Do you have any clue why?

avatar image phoboz Feb 26 '16 at 09:50 PM

Nope, but if you upload logs it might be helpful

avatar image smara Feb 26 '16 at 10:09 PM

[2016.02.26-22.08.34:300][454]LogBlueprintUserMessages: Late PlayInEditor Detection: Level '/Game/FlyingCPP/Maps/FlyingExampleMap.FlyingExampleMap:PersistentLevel' has LevelScriptBlueprint '/Game/FlyingCPP/Maps/FlyingExampleMap.FlyingExampleMap:PersistentLevel.FlyingExampleMap' with GeneratedClass '/Game/FlyingCPP/Maps/FlyingExampleMap.FlyingExampleMap_C' with ClassGeneratedBy '/Game/FlyingCPP/Maps/FlyingExampleMap.FlyingExampleMap:PersistentLevel.FlyingExampleMap' [2016.02.26-22.08.35:554][454]LogCrashTracker:

[2016.02.26-22.08.35:558][454]LogCrashTracker:

[2016.02.26-22.08.35:558][454]LogWindows:Error: === Critical error: === Fatal error!

[2016.02.26-22.08.35:582][454]LogExit: Executing StaticShutdownAfterError [2016.02.26-22.08.35:584][454]LogPhysics:Warning: PHYSX: ....\PhysX\src\NpScene.cpp (2946) 8 : PxScene::unlockWrite() called without matching call to PxScene::lockWrite(), behaviour will be undefined. [2016.02.26-22.08.35:584][454]LogPhysics:Warning: PHYSX: ....\PhysX\src\NpScene.cpp (2946) 8 : PxScene::unlockWrite() called without matching call to PxScene::lockWrite(), behaviour will be undefined. [2016.02.26-22.08.35:584][454]LogPhysics:Warning: PHYSX: ....\PhysX\src\NpScene.cpp (2946) 8 : PxScene::unlockWrite() called without matching call to PxScene::lockWrite(), behaviour will be undefined. [2016.02.26-22.08.35:584][454]LogPhysics:Warning: PHYSX: ....\PhysX\src\NpScene.cpp (2946) 8 : PxScene::unlockWrite() called without matching call to PxScene::lockWrite(), behaviour will be undefined. [2016.02.26-22.08.35:584][454]LogWindows: FPlatformMisc::RequestExit(1) [2016.02.26-22.08.35:584][454]Log file closed, 02/26/16 23:08:35

avatar image smara Mar 24 '16 at 07:21 PM

Hi, I just wanted to notify you, that I fixed this crash error some time ago.

It turned out that my PlayerController accessed the pawn without checking if the possessed pawn is not null. On Unity im used to have this kind of error in my console. Here however the whole client crashes. Interesting :P

Thanks again for your help.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi, solution can be found at posted question.

Simple answer: just turning collisions on is not enough, you have to specify the Collision Presets. This configure against which actors a collision creates an event.

more ▼

answered Mar 24 '16 at 07:17 PM

avatar image

smara
67 6 9 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question