PSK Update
by Phillip O'Shea · 04/13/2009 (2:33 pm) · 9 comments
The PSK (1.1.1) update is live!
It fixes a number of issues found in this thread, www.garagegames.com/community/forums/viewthread/86673 and introduces the ability to add custom Physics and Animation states to your actors.
I have also moved the legacy behaviors to another folder, though they remain there as a reference.
Here is a quick outline of what you need to do to set it up. The Animation Tutorial on TDN will be updated shortly to work nicely with these changes.
Custom Physics State
When you create your actor, you must register a custom state with the pskActor object.
Since the Actor's core is unaware of the state you have created, you will have to manually set the state when it is appropriate.
Now that we can execute the state, we need to create two methods that control state transitions, as well as what the state actually does to our object.
One of the best things about this functionality is that you can override the existing states! If you register any of the following states, then they are yours to modify in script:
Custom Animation State
Very similar to above:
Fin.
That is it folks, a small update which should be of massive benefit to all PSK users.
It fixes a number of issues found in this thread, www.garagegames.com/community/forums/viewthread/86673 and introduces the ability to add custom Physics and Animation states to your actors.
I have also moved the legacy behaviors to another folder, though they remain there as a reference.
Here is a quick outline of what you need to do to set it up. The Animation Tutorial on TDN will be updated shortly to work nicely with these changes.
Custom Physics State
When you create your actor, you must register a custom state with the pskActor object.
function MyActorClass::onAdd( %this )
{
// Register My New State
%this.registerPhysicsState( "MyCustom" );
}Since the Actor's core is unaware of the state you have created, you will have to manually set the state when it is appropriate.
... %this.setPhysicsState( "MyCustom" ); ...
Now that we can execute the state, we need to create two methods that control state transitions, as well as what the state actually does to our object.
function MyActorClass::executeMyCustomPhysicsState( %this )
{
// This method is used to tell the FSM which state we should be in
// based on what you return here. Returning "NULL" or "" will
// maintain this state.
if ( !%this.Alive )
{
return "isDead";
}
return "NULL";
}
function MyActorClass::updateMyCustomPhysicsState( %this )
{
// This method is updated every tick.
}One of the best things about this functionality is that you can override the existing states! If you register any of the following states, then they are yours to modify in script:
- onGround - inAir - onLadder - isDead
Custom Animation State
Very similar to above:
function MyActorClass::onAdd( %this )
{
// Register My New State
%this.registerAnimationState( "MyCustom" );
}... %this.setAnimationState( "MyCustom" ); ...
function MyActorClass::enterMyCustomAnimationState( %this )
{
// In this function, all you need to do is return the name
// of the Animation datablock that you would like to transition to
// and the engine will take care of the rest.
return MyCustomAnimation;
}
function MyActorClass::executeMyCustomAnimationState( %this )
{
// This is just like the Physics method, you just specify
// the animation that you need to move to next, or return ""
// or "NULL" to maintain this animation state.
return "NULL";
}Fin.
That is it folks, a small update which should be of massive benefit to all PSK users.
About the author
Head of Violent Tulip, a small independent software development company working in Wollongong, Australia. Go to http://www.violent-tulip.com/ to see our latest offerings.
#2
04/13/2009 (3:01 pm)
Sorry Henry!
#4
04/13/2009 (3:30 pm)
Lets hope I got all of the problems... =P
#5
04/13/2009 (4:30 pm)
Woo hoo! Downloading now. I cant wait to try it out. Thanks for the update
#6
04/13/2009 (4:31 pm)
Phillip, is there some way I can contact you personally? I am having extreme problems with the psk and don't understand what I'm missing...
#7
04/13/2009 (4:38 pm)
Sure thing, {snip}
#8
04/13/2009 (4:49 pm)
thanks
#9
Thanks Dr. Phil. ;)
04/14/2009 (7:02 am)
Prebuilding access to custom physics states... I smell something cooking over at the TGB camp!Thanks Dr. Phil. ;)

Torque 3D Owner Henry Shilling
Smokin Skull