Results 1 to 17 of 17
  1. #1

    Default KActor Touch problem

    Hello everyone !
    I almost find every answer I need here (very nice forum !), but now there is an exception. Even with hours and hours of research, I can't find the solution to my problems, and that's really frustrating !

    I work on a game where the player can control a ball. This ball is a KActor and normal collisions (with the world) work well, the ball can roll and move as expected. However I have some problems, particularly about "Touch" detection for the ball.

    For example, if I have a TriggerVolume, the "Touch" event with the ball is detected using the bounding box of the ball, and not the ball itself. That lead to very strange behaviors sometimes, especially because this bounding box is moving and scaling all the time... strange, like if the ball was in fact a rolling cube, and not a sphere. Here is an image illustrating the problem, you can see the "Touch" log to the left when the blue box has just entered the TriggerVolume :

    Touch ! That's wrong !

    --> How can I say to volumes to "Touch" with the yellow bounds (the sphere bounds) or the simple sphere collision instead of the strange blue bouding box ?

    A second problem, that may somehow be related to the first one, happens with collision components with my actors (actors that I create in UnrealScript for example).
    On the following images, I have an Actor (let's call it A) on the center of the circle that have a cylinder component for collision component. The ball doesn't "Touch" this collision component like TriggerVolume before. On the next image, we can think we see a normal behavior, because the blue bounding box of the ball touches the cylinder component and the bounding box of the actor A, and there is no Touch detection (top view) :

    No Touch ! This is normal.

    The problem is that the "Touch" event happens when the ball enters in the bounding box of the actor A, instead of the collision component (cylinder) that I defined for this actor. Like here (top view) :

    Touch ! That's unexpected !

    I would like the ball to "Touch" the actor only when the ball touches the cylinder component, not its bouding box. In fact, I don't know if this red volume is actually the "bouding box" of the actor A, because it only shows up with the "show collision" command and... it's red. But I never asked for this red collision volume.
    --> How can I solve this second problem (with properties, unrealscript, ...) ? Maybe the source of this problem is the same as the first one above.

    In the ball Mesh properties, I have unchecked "Use Simple Box Collision" and "Use Simple Line Collision" (it is even worse if I check these). I also tried to change the collision type of the TriggerVolume and the actor A, but it leads to nothing. Where could I look now ?

    Thanks for your time reading and helping me.
    Have a nice day.
    Last edited by Jereak; 05-16-2012 at 08:19 AM.

  2. #2
    MSgt. Shooter Person
    Join Date
    May 2009
    Posts
    51

    Default

    For the first problem: Maybe it helps if you set the CollisionComponent of your ball to the same as the mesh is? Don't know whether that is already the case, just an idea.
    Also, in the UDK Editor, if you edit the PhysicalAsset of the ball, you can make it use a simplified bounding box of type "Shpere" though I don't know whether this counts for the normal physics or for the actually touch logic.. or for both.

    --Marenz

  3. #3

    Default

    Thanks for this quick response.
    The CollisionComponent of the ball should already be the same as its Mesh, because it's a KActor, that inherits DynamicSMActor, that have "CollisionComponent=StaticMeshComponent0" in its defaultproperties. I tried to do it again in my ball subclass and it didn't change anything, so it may not be the source of the problem.

    And isn't PhysicsAsset for skeletal mesh only ? Joints, shapes, ... ?
    Last edited by Jereak; 05-16-2012 at 08:41 AM.

  4. #4
    MSgt. Shooter Person
    Join Date
    May 2009
    Posts
    51

    Default

    I was typing from my memory, and the memory was wrong. What I meant was the "StaticMesh' in the static mesh editor of the ball-mesh. In the view menu you can enable "Collision" to see what it currently has.
    If it is that box that you see, go to the collision menu and choose "sphere simplified collision". (again, just ideas)

    --Marenz

  5. #5

    Default

    Ok ! Thanks again, but it's already "sphere simplified collision", it wouldn't roll so well if it wasn't.
    By the way, in this StaticMesh editor, I tried to uncheck "consider for bounds" in BodySetup, it sounded well but it made no change at all.
    Last edited by Jereak; 05-17-2012 at 09:03 AM.

  6. #6

    Default

    Up !
    A little more information, perhaps it will help.
    Here are the default properties of the actor A (the one with cylinder component for collision). I removed properties that have no relation with collisions :
    Code:
    defaultproperties
    {
    	// ...
    	
    	Begin Object Class=CylinderComponent Name=CollisionCylinder
    		CollisionRadius=+00128.000000
    		CollisionHeight=+0048.000000
    		CylinderColor=(R=200,G=128,B=255,A=255)
    		bAlwaysRenderIfSelected=true
    		HiddenGame=true
    		
    		CollideActors=true
    	End Object
    	CollisionComponent=CollisionCylinder
    	Components.Add(CollisionCylinder)
    	
    	bCollideActors=true
    	bBlockActors=false
    	
    	// ...
    }
    Actor A is a subclass of Actor, it has no other properties about collision at all.

  7. #7
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    For 1. and 2. use static mesh as collision...

  8. #8

    Default

    Hi !
    That's the problem actually ! I don't know how to "use static mesh as collision".
    If you mean trying that :
    Code:
    defaultproperties
    {
            // ...
    
    	Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0
    	        // ...
    	End Object
    	CollisionComponent=StaticMeshComponent0
    	StaticMeshComponent=StaticMeshComponent0
    
            // ...
    }
    It's already done, because the ball is a subclass of DynamicSMActor (defaultproperties above are in DynamicSMActor ). Anyway, I tried to add it myself in the ball class and it was the same problem.
    Did you meant something else ?

    I think the problem comes from some properties in collision components or mesh, but I can't find where.

  9. #9
    Banned
    Join Date
    Feb 2011
    Location
    BXL/Paris
    Posts
    2,169

    Default

    Just add second SMC, use the same SM as first only make it a little bigger, set hidden, disable any lighting related stuff, any block except BlockNonZeroExtent, set CollideActors and bDisableAllRigidBody - Touch should be called...

    ...don't forget to uncheck Use Simple Box Collision and Use Simple Line Collision...

  10. #10

    Default

    This should help.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  11. #11

    Default

    Thanks for answers !

    @VendorX : Perhaps I don't understand what you mean, but all theses properties are already set like that, and I already have Touch events. The problem is that there is no precision because of touching with the bouding box of the ball. Trying what you propose here doesn't change anything.

    @willyg302 : That's exactly what I want to do ! Touching a Volume with a KActor precisely. So it wouldn't be possible with Touch, but with RigidBodyCollision ? I tried it, but I can't get RigidBodyCollision called, both in the volume class and in the ball class. Did I miss some properties somewhere ?
    In fact, is it really possible to have a RigidBodyCollision with a volume ? According to your link, it should be, but I don't know how. What sneaky hidden properties must I change... ?
    I have tried to change many properties, even changing the volume physics to Phys_RigidBody (it sounds stupid, I know).

  12. #12

    Default

    The code should be in the ball class (the KActor, in other words). To my knowledge no "sneaky code" is needed, if the volume is set up for collision then when the ball hits it, it will register as a rigid body collision. The actual component passed to RigidBodyCollision(), that is the "OtherComponent", will be the BrushComponent of the volume. So all you'd need to do is grab the parent of this brush component by doing something like TriggerVolume(OtherComponent.Owner) != none. This will test whether the owner of the component is a trigger volume. If it is, you do stuff.

    Hope that makes sense!
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  13. #13

    Default

    That makes sense, and actually that's exactly what I am trying.
    Here is the code of my two test classes for this problem :

    a sub-TriggerVolume :
    Code:
    class MyTriggerVolume extends TriggerVolume
    	placeable;
    
    event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal ) {
    	`log("MyTriggerVolume Touch");
    	if (OtherComp != NONE && MyKActor(OtherComp.Owner) != NONE)
    		`log("Touches MyKActor");
    }
    
    event RigidBodyCollision(PrimitiveComponent HitComponent, PrimitiveComponent OtherComponent,
    	const out CollisionImpactData RigidCollisionData, int ContactIndex)
    {
    	`log("MyTriggerVolume RBCollision");
    	if (OtherComponent != NONE && MyKActor(OtherComponent.Owner) != NONE)
    		`log(">>>>>>>>>>>>>>>>   MyKActor RB-DETECTED   <<<<<<<<<<<<<<<<");
    }
    
    defaultproperties
    {
    	Begin Object name=BrushComponent0
    		CollideActors=true
    		BlockZeroExtent=true
    		BlockNonZeroExtent=true
    		
    		bNotifyRigidBodyCollision=true
    		ScriptRigidBodyCollisionThreshold=0.0001
    		
    		RBChannel=RBCC_GameplayPhysics
    		RBCollideWithChannels=(GameplayPhysics=true)
    	End Object
    	CollisionComponent=BrushComponent0
    	
    	bNoEncroachCheck=false
    	bIgnoreEncroachers=false
    	bCollideActors=true
    }
    and a sub-KActor :
    Code:
    class MyKActor extends KActor
    	placeable;
    
    event Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal ) {
    	`log("MyKActor Touch");
    	if (OtherComp != NONE && MyTriggerVolume(OtherComp.Owner) != NONE)
    		`log("Touches MyTriggerVolume");
    }
    
    event RigidBodyCollision(PrimitiveComponent HitComponent, PrimitiveComponent OtherComponent,
    	const out CollisionImpactData RigidCollisionData, int ContactIndex)
    {
    	`log("MyKActor RBCollision");
    	if (OtherComponent != NONE) {
    		if (BrushComponent(OtherComponent) != NONE)
    			`log("BrushComponent RBC-DETECTED");
    		if (MyTriggerVolume(OtherComponent.Owner) != NONE)
    			`log("################   VOLUME RBC-DETECTED   ################");
    	}
    	
    }
    
    defaultproperties
    {
    	Begin Object name=StaticMeshComponent0
    		StaticMesh=StaticMesh'LLBPackage.Balls.Ball5.LLB_Ball5'
    		
    		CollideActors=true
    		BlockZeroExtent=true
    		BlockNonZeroExtent=true
    		
    		bNotifyRigidBodyCollision=true
    		ScriptRigidBodyCollisionThreshold=0.0001
    		
    		RBChannel=RBCC_GameplayPhysics
    		RBCollideWithChannels=(GameplayPhysics=true)
    	End Object
    	CollisionComponent=StaticMeshComponent0
    	
    	Physics=PHYS_RigidBody
    	bWakeOnLevelStart=true
    	
    	bCollideAsEncroacher=false
    	bNoEncroachCheck=false
    	bIgnoreEncroachers=false
    	bCollideWorld=true
    	bCollideActors=true
    }
    I have created a map where a MyKActor (a ball in this case) rolls down and go in the trigger volume (a MyTriggerVolyme, of course).

    - The ball rolls and collides very well with the world, bsp, staticmesh, other KActors, etc.
    - The Touch event is called, I can see my four different logs in both classes ("MyTriggerVolume Touch", "Touches MyKActor", "MyKActor Touch" and "Touches MyTriggerVolume").
    - I can see the "MyKActor RBCollision" log almost every frame when it rolls on the ground, but never when it hits the volume (no "MyKActor RBCollision" when the ball enters in and no "VOLUME RBC-DETECTED" log).

    As you can see, I have tried many properties, true/false on theses and others... changing chanels, the value of ScriptRigidBodyCollisionThreshold...
    Any idea ?

    (Even better, if someone thinks he can make it work and can try to code this successfully, it would be great ! )
    Last edited by Jereak; 05-26-2012 at 12:46 AM.

  14. #14
    MSgt. Shooter Person
    Join Date
    Feb 2008
    Location
    Blackpool
    Posts
    99

    Default

    in the properties for the TriggerVolume , have you tried adding BlockRigidBody=true ? I remember it being false by default which would cause a lack of event notices for rigid body collision.

  15. #15

    Default

    Hi there !
    I added "bDisableAllRigidBody=false" in the BrushComponent of the Volume, it seems to be important, but it has no effect for now.

    Doublezer0 : Actually, I don't want the ball to be blocked by the volume. I just want the TriggerVolume or the KActor to call the RigidBodyCollision event when the KActor goes through the volume.
    Anyway, I tried what you said, and as expected it blocks the ball very well. I can see my "VOLUME RBC-DETECTED" log. The only problem is that it actually blocks the ball.
    In fact, is it really possible to have a RigidBodyCollision without blocking ? For me, it should be, because a "collision" is not a "blocking", and Willyg302 seems to explain that it is possible (perhaps I misunderstood ?), but I can't figure out how.

    Otherwise willyg302, if you successfully coded it like in the "More Accurate Trigger Events" article you wrote, perhaps you could show me this code in order for me to understand where I am wrong ?

    It should be possible, because like I said in my first post, there is another kind of "collision volume" for one of my actors that has exactly the behavior that I want (Touches exactly when the ball itself enters in, ignoring the ball bounding box). The problem is that it didn't create this volume and I have no control on it... (that was the "second problem" in my first post, explained with the two last images).
    So, detecting KActor with precision AND without blocking IS possible... but I don't know how to make it work with a "normal" volume.
    Last edited by Jereak; 05-23-2012 at 06:04 AM.

  16. #16

    Default

    Weird that it doesn't work...what I have is a custom volume that extends DynamicTriggerVolume, and there's practically nothing in it (it's just different so my ball will not react to normal DynamicTriggerVolumes too). I'm not sure exactly what's missing, but after digging through the classes I found this in BrushComponent:

    Code:
    native final function SetNotifyRigidBodyCollision(bool bNewNotifyRigidBodyCollision);
    This is the component that your volume owns. So you could do MyVolume.BrushComponent.SetNotifyRigidBodyCollisio n(true); and see if that works. But yes you're right "collision" and "blocking" are not the same thing, so it should be possible.
    Try my game Never End, now on the App Store! For more info, see the release thread.

    My Blog: WillyG Productions - Your Premiere UDK Resource
    My YouTube Channel: WillyG Productions
    My Facebook Page: WillyG Productions

  17. #17

    Default

    Hum... actually, it's already done in the defaultproperties :
    Code:
    class MyTriggerVolume extends DynamicTriggerVolume
    	placeable;
    
    //...
    
    defaultproperties
    {
    	Begin Object name=BrushComponent0
    		//...
    		bNotifyRigidBodyCollision=true
    		ScriptRigidBodyCollisionThreshold=0.0001
    		//...
    	End Object
    	// ...
    }
    And even with doing it again somewhere like in PostBeginPlay(), it doesn't change anything.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.