PDA

View Full Version : StaticMesh collision and touches



byteasc
11-15-2009, 08:20 PM
Man, I feel like a noob, but it has been so long since doing alot of UnrealScript and didn't do anything with UT3 script wise.

What is the proper way to get a staticmesh setup that will collide and block, from within unrealscript?



Begin Object Class=StaticMeshComponent Name=BaseMeshComp
StaticMesh=StaticMesh'Asc_ByteTest.TestModel'
CollideActors=true
BlockActors=true
BlockNonZeroExtent=true
BlockZeroExtent=true
End Object
CollisionComponent=BaseMeshComp
Components.Add(BaseMeshComp)


That is my current component definition and it does block properly and show collision (via show collision in console), but I'm having trouble generating Touch events (via collision).

I understand I might can do a Cylinder for collision, but I need to make sure the mesh itself will still block components and that Touch events will get generated.

schizoslayer
11-16-2009, 05:05 AM
If your mesh is blocking then you cannot receive Touch events on the actor because Touch events are only triggered when one actor encroaches upon another. As nothing can penetrate your mesh you will not receive touch events.

You may want to look at the Bumped, HitWall, Landed, and RigidBodyCollision events instead.

ken_13
12-12-2009, 01:20 PM
i have a same problem i use a sphere as my player and right my own playercontroller and player but the sphere didn't touch any trigger.
can you help me
http://utforums.epicgames.com/showthread.php?t=711653

imspikey
12-13-2009, 09:44 AM
this might help http://www.hourences.com/book/tutorialsue3modeling1.htm

also

defaultproperties
{
Begin Object Class=staticmeshcomponent Name=Healshpere
StaticMesh=StaticMesh'MyPackage.MynewGroup.Healshp ere'
End Object


Components.Add(Healshpere)
bCanBeDamaged=true
bCollideActors=true
bBlockActors = true
bCollideAsEncroacher=true


}

function Touch( Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal )
{

pawn(Other).Health += 10;
pawn(Other).ShotCount += 10;

}

imspikey
12-13-2009, 03:24 PM
so her is the final solution
1-if extending class actor


class HealSphear extends Actor

placeable;
var TraceHitInfo asa;
defaultproperties
{
Begin Object Class=staticmeshcomponent Name=Healshpere
StaticMesh=StaticMesh'MyPackage.MynewGroup.Healshp ere'


End Object



Components.Add(Healshpere)
bCollideActors=true;
bBlockActors=true;


}
function Bump( Actor Other, PrimitiveComponent OtherComp, Vector HitNormal )

{
Pawn(Other).Health +=10;
}


2-if extending kactor or KActorSpawnable


class HealSphear extends KActor

placeable;

defaultproperties
{
Begin Object Class=staticmeshcomponent Name=Healshpere
StaticMesh=StaticMesh'MyPackage.MynewGroup.Healshp ere'


End Object

CollisionComponent=Healshpere

Components.Add(Healshpere)



}
function Bump( Actor Other, PrimitiveComponent OtherComp, Vector HitNormal )

{
Pawn(Other).Health +=10;
}

imspikey
12-13-2009, 03:28 PM
thanks schizoslayer it workd

ken_13
12-13-2009, 04:26 PM
How can i make this ball as a player ( i don't mean coding for gameplay i want to switch on the "PLAYERONLY" tag in trigger and it detect it as a player )

Blade[UG]
12-13-2009, 06:49 PM
I don't have an answer for you, but I do want to point out that you will have a lot fewer problems with coding if you spell things both consistently and properly. (consistently moreso than properly) "Sphere". And no, I'm not trying to be a grammar jerk, but you have "shpere" and "sphear".