T3D 360 Movement, Double Jump, And Lock-On (Files)
by Kevin Mitchell · 07/15/2011 (4:07 pm) · 1 comments
This is a release of the lock on feature I have created for T3D, this includes the previous file changes for 360 rotation and double jump. I believe this should help those who are also looking to modify the engine for their own desired purposes.
Files are locked in the Private forms Here.
To get the feature up and going you can add this in.
PlayerSystem.cs
bind file
This inherits some functions from the AIPlayer. So some things might look familar. Calculating the targt position is a little jerky with moving targets. Might be my setup. Let me know if you experiance the same.
Video:
Let me know if there are issues.
Thanks.
Kevin.
Files are locked in the Private forms Here.
To get the feature up and going you can add this in.
PlayerSystem.cs
$Interaction::NONE=0;
$Interaction::ItemStore=1;
$Interaction::ArmorStore=2;
$Interaction::WeaponStore=3;
$Interaction::NPC=4;
$Interaction::TreasureChest=5;
$Interaction::BattleGrounds=6;
$PLAYER::InteractNPC="";
$PLAYER::InteractMobLock="";
$PLAYER::PlayerInteractionCheck=0;
$PlayerObject::ClientControl=0;
$PlayerObject::ScanEnabled=false;
$PlayerObject::NPC_DETECT_RADIUS=1;
$PlayerObject::MOB_DETECT_RADIUS=15;
//GATHERS PLAYER CLIENT REFERENCE
function StorePlayerClient(%player){
$PlayerObject::ClientControl = %player;
}
function GetClientControlPos(){
return $PlayerObject::ClientControl.getEyeTransform();
}
//USED FOR THE INTERACTION NPC CHECKS
function StartScan(){
$PlayerObject::ScanEnabled=true;
schedule(500,0,"CheckNPC",$PlayerObject::ClientControl);
schedule(500,0,"CheckMobLock",$PlayerObject::ClientControl);
schedule(500,0,"InteractionDetection",$PlayerObject::ClientControl);
}
function StopScan(){
$PlayerObject::ScanEnabled=false;
}
$Player::Obstacles =
$TypeMasks::PlayerObjectType |
$TypeMasks::ShapeBaseObjectType |
$TypeMasks::StaticObjectType |
$TypeMasks::StaticRenderedObjectType |
$TypeMasks::StaticShapeObjectType |
$TypeMasks::StaticTSObjectType;
function CheckMobLock( %obj)
{
//echo("SCAN NOW2");
if($PlayerObject::ScanEnabled==false){
schedule(500,0,"CheckMobLock",%obj);
}
%npcold=%npc=-1;
%npc = containerFindFirst( $Player::Obstacles, GetClientControlPos(),$PlayerObject::MOB_DETECT_RADIUS,$PlayerObject::MOB_DETECT_RADIUS,$PlayerObject::MOB_DETECT_RADIUS);
//echo("SCAN NOW");
while(%npc>-1&& %npcold!=%npc){
%name = %npc.GlossaryName;
if(%name $= "MobCharacter"){
//echo("CHARACTER: "@%name);
$PLAYER::InteractMobLock=%npc;
//$PLAYER::PlayerInteractionCheck=$Interaction::NPC;
%npcold=%npc;
if($PlayerObject::ScanEnabled){
schedule(500,0,"CheckMobLock",%obj);
schedule(500,0,"DeinteractMobLock",%obj);
}
return;
}else{
%npcold=%npc;
%npc = containerFindNext();
}
}
schedule(500,0,"CheckMobLock",%obj);
}
function DeinteractMobLock( %obj){
if($PlayerObject::ScanEnabled){
if($PLAYER::InteractMobLock>0){
if(VectorDist( $PLAYER::InteractMobLock.getTransform(),GetClientControlPos())>20){
//echo("LOST NPC");
$PLAYER::InteractMobLock=0;
$PlayerObject::ClientControl.clearAim();
$LOCK::ON=0;
}
schedule(500,0,"DeinteractMobLock",%obj);
}
}
}bind file
moveMap.bind( gamepad, btn_b, RPG_B_BTN );
//jump function
function RPG_B_BTN(%val)
{
if($_DEBUG_BTNS&&%val)echo("RPG_B_BTN");
if(%val){
lockOnTarget(%val);
}
}
function lockOnTarget(%val){
//echo("lockOnTarget");
%player = LocalClientConnection.getControlObject();
if(%val){
if($LOCK::ON==0 && isObject($PLAYER::InteractMobLock)){
%player.setAimObject($PLAYER::InteractMobLock);
$LOCK::ON=1;
}else{
if($_DEBUG_BTNS&&%val)echo("clearAim");
%player.clearAim();
$LOCK::ON=0;
}
}
}This inherits some functions from the AIPlayer. So some things might look familar. Calculating the targt position is a little jerky with moving targets. Might be my setup. Let me know if you experiance the same.
Video:
Let me know if there are issues.
Thanks.
Kevin.
About the author
Riding Solo since 2005. Current Project: Fated World 2005-Present RPG Engine Tool Kit - Now available.

Torque Owner Glenn Bermingham
Demon Flame