Collision detection in unreal script and Using c++ in runtime...(with picture)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

flake1214

New Member
Apr 6, 2006
2
0
0
Hi all,
I am new in coding unreal script for unreal runtime.

I edited a simple catching ball game

sample.bmp


the arm and the ball are subclass of "StaticMeshActor" and they are
created in unreal script. I plan to let the arm to catch the ball. I
wonder how I can know the ball hit the arm. Is there any var in
"StaticMeshActor" can tell us this information, like the ball collides with
the arm?

The second question is that I'd like to know how we can let unreal
script communicate with c++, such as calling user-defined c++ function
in unreal script. I have found a website talks a little bit about it by using
.dll or some magical functions in unreal script

http://unreal.epicgame.com/CppObjects.html

However, I am still confused about how to exactly use them. Is there any
one can give me some help?

Thanks

Rebecca
 

Continuum

Lobotomistician
Jul 24, 2005
1,305
0
0
43
Boise
To use any external code I believe you need the runtime, the link has a demo but I have no idea if the demo will work. I imagine you probably need to buy the runtime :(

http://udn.epicgames.com/Two/UnrealEngine2Runtime22262002

there are others that could probably answere your question better though (I think it is possible to run something through tcp... but I doubt it would be ideal for your situation)
 

flake1214

New Member
Apr 6, 2006
2
0
0
Thanks for your quick reply, Continnum....

I have UT 2004 installed in my pc now. And I found there is wiki
website providing source code for UT2004 unreal script

http://wiki.beyondunreal.com/wiki/UnrealScript_Source

In some of the directories in the source code, such as Engine, we can
find there are .cpp files in it. I just wonder can we get these script compiled
in unreal runtime or only in UT2004 with .cpp files?


best,
Rebecca
 

Angel_Mapper

Goooooooats
Jun 17, 2001
3,532
3
38
Cape Suzette
www.angelmapper.com
The only way you can have the game communicate with C++ without a full engine license would be to use a UDP/TCP link:

http://wiki.beyondunreal.com/wiki/TcpLink
http://wiki.beyondunreal.com/wiki/UdpLink

As for collision, HitWall is called when an actor collides with a static mesh, as long as the one you're using isn't part of the HUD or the staticmesh of a Weapon subclass (those "aren't really there" as far as the world goes).

What you might want to do is make the arm an animated mesh (animations wouldn't be necessary, just the bones). You could then calculate wether or not the ball is in between two of the bones, say one in the pinky and thumb, to see if the ball has been caught, similar to how the Scorpion in UT2004 figures out if someone's been caught in the blades (this is in Tick):

Code:
....
    local Coords ArmBaseCoords, ArmTipCoords;
    local vector HitLocation, HitNormal;
    local actor Victim;

    ArmBaseCoords = GetBoneCoords('CarLShoulder');
    ArmTipCoords = GetBoneCoords('LeftBladeDummy');
    Victim = Trace(HitLocation, HitNormal, ArmTipCoords.Origin, ArmBaseCoords.Origin);

    if (Victim != None && Victim.bBlockActors)
    {
        if (Victim.IsA('Pawn') && !Victim.IsA('Vehicle'))
            Pawn(Victim).TakeDamage(1000, self, HitLocation, Velocity * 100, class'DamTypeONSRVBlade');

....