HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - dagobah

Pages: [1]
1
Design & World Building / Re: [Resolved] Arrival Path question
« on: Jan 02, 21, 05:56:06 PM »
Hi i know this was a post of ten years ago now lol, but may i ask waht the final code to set the rotation of the path is i tried mine but i got no luck  :(


code going to position and rotation:

Code: [Select]
pos as Vector3
  rot as Vector3
  where account
    is kindof _SessionStarting
      if GetAreaNumber() != $CLEANTESTAREA._getCleanTestArea()
        Debug( "LoginProcess", pc.name + " is logging into the game as an existing character.  Using last known position " + vc.character_position + ", and rotation " + vc.character_rotation + "." )
        account._TeleportPlayer( vc.character_position, vc.character_rotation )
      else
        account._TeleportPlayer( pos, rot )
      .
      return
    .
    default
      connection as NodeRef of Class _PlayerConnection = GetPlayerConnectionNode( account )
      where connection
        is kindof _TravelTarget
          targetAccount as NodeRef of Class _PlayerAccount = FindPlayerByName( connection._travelTargetCharacter )
          if targetAccount == None
            goto notarget
          .
          targetPC as NodeRef of Class _PlayerCharacter = targetAccount.GetMyChar()
          RemoveClassFromNode( "_TravelTarget", connection )
          if targetPC != None
            account._TeleportPlayer( targetPC.GetPosition(), targetPC.GetRotation() )
          else
            goto notarget
          .
        .
        default
          label notarget
          path as NodeRef of Class PathNode = PathUtils:GetPathByName( "Arrival" )
          if path != None
            pos = GetPositionOnPath( path )
            rot = GetRotationOnPath( path )
            Debug( "LoginProcess", name + " is moving between areas and I found an Arrival path (" + path + ").  Teleporting to " + pos + "." )
            account._TeleportPlayer( pos, rot )
          else
            Debug ( "LoginProcess", "No Arrival path found or target for " + name + " in area '" + GetAreaName( GetAreaNumber() ) + "', so positioning at origin." )
            account._TeleportPlayer( pos, rot )
          .
        .
      .
    .
  .
.


code to get rotation
Code: [Select]
function GetRotationOnPath( path as NodeRef of Class PathNode ) as Vector3
  if path == None
    return "(0,0,0)"
  .
 
  area as NodeRef of Class _Area = $AREA
  if not ( area is kindof ArrivalPointData )
    GlomClass( "ArrivalPointData", area )
  .
 
  where area is kindof ArrivalPointData
    waypoint as NodeRef of Class PathPointNode = PathUtils:GetNextWaypoint( path, area.lastWaypoint )
    if waypoint != None
      area.lastWaypoint = waypoint
      return waypoint.PathPointRotation
    else
      waypoint = PathUtils:GetFirstWaypoint( path )
      if waypoint != None
        area.lastWaypoint = waypoint
        return waypoint.PathPointRotation
      else
        return "(0,0,0)"
      .
    .
  .
.


help me please!



2
Hi, thanks for answering i having o9ne mor problem, everything else is doing fine but if i change the state this error pops out

14:18:42: ERROR:SCRIPT:[_StateActionTransformClassMethods]:_StateActionTransformClassMethods is requesting the transform of the HBNode(9223372061388026814) but its PhysicsType is neither DYNAMIC nor NO_PHYSICS.  This will result in a performance hit.

but as you said the elevator needs the KINEMATIC physicsType to "collide" with the player, so what can i do?

thanks and happy new year!

3
thanks for the fast answer, well i tried that due to the error, but i find a way to fix it, idk if is the correct way but i did this:

Code: [Select]
// Get elevator and player, check if player is riding it using
// raycasting
public function DetectElevator(Accc as NodeRef of Class TWW_ACCController)
  var player = MiscUtils:getCharPointer()
  char as NodeRef = player._getACCController()._accControllerOwnerRef
 
  origin as Vector3
  GetNodePosition(char, origin)

  acct as NodeRef of Class E_playerAccount = GetAccountID()
  ride as NodeRef of Class RideObject = acct.ridePointer

  direction as Vector3 = (0,-1,0)  // detect below player
  intercept as Vector3
  distance as Float = 0.2          // detect upto 2 meters (0.2 units)
  meshName as String

  excludedNodes as List of NodeRef
  add back char to excludedNodes
 
  if ride.rideNode <> None
    GetNodePosition(ride.rideNode, ride.ridePosition)
    hit as NodeRef = Raycast3D(origin, direction, excludedNodes, distance, intercept, meshName)
    if intercept != (0,0,0)
      if ride.rideDirection = "up"
        check as Vector3
        check.y = ride.ridePosition.y + 0.05      // need 0.05 or player falls thru
          if origin.y < check.y                   // check player is above fall thru distance
            origin.y = check.y
          .
      .
      SetNodePosition(GetAccountID(), origin)
    .
  .

  // debug line to show direction of check
  //DrawDebugRay(origin, origin + (direction * 10), 0.05, "FF0000", "FF0000", 1.0, false)
  //if intercept != (0,0,0)
  //  DrawDebugPoint(intercept, 0.1, "00FF00", 1.0, true)
  //.
.

// function called from main State System scripts - _StateActionCallScriptClassMethods()
// used with the CallScript option
shared function _OnDoStateAction( action as NodeRef of Class _StateAction )
  acct as NodeRef of Class E_playerAccount = GetAccountID()
  acct.ridePointer = createNodeFromClass("RideObject")
  ride as NodeRef of Class RideObject = acct.ridePointer

  object as NodeRef = getObject(action)
  ObjLocate as Vector3
  GetNodePosition(object, ObjLocate)

  direction as String = getDirection(action)
 
  // save current object we are riding
  //println("riding "+object+"  Dir "+direction)
  ride.rideDirection = direction
  ride.rideNode = object
  ride.ridePosition = ObjLocate
.



i dont undertood why you set the account as the ridePointer , instead i create a node from the class and select from there all the information

acct.ridePointer = createNodeFromClass("RideObject")
 
is it good this way? or can you explain me why did you used acct.ridePointer = GetAccountID()???

it works well for me but i dont know if in a specific case will broke down...

4
Hi Thazager hope you answer my question i see that the last time you talk about this theme was a long ago but i'll try at least, First thanks so much for posting this info it is very usefull for new HE developers as me.

i'm using your method to make a kind of elevator with the state system but i'm having troubles with making the player staying on the top of the elevator every time the state changes the playes just falls and i keep reciving this error from the console


16:45:30: SCRIPT:[HBNodeClassMethods]:toggle open/close for 9223372061041021981
16:45:30: ERROR:SCRIPT:[_StateActionTransformClassMethods]:_StateActionTransformClassMethods is requesting the transform of the HBNode(9223372061041021981) but its PhysicsType is neither DYNAMIC nor NO_PHYSICS.  This will result in a performance hit.
16:45:30: SCRIPT:[RideObjectClassMethods]:riding 9223372061041021981  Dir up
16:45:30: ERROR:HeroScript::HeroMachine::ScriptError:GOM::getVariableReferenceFromNode (10823): requested node ID (0) not found
16:45:30: ERROR:System:SCRIPT ERROR: GOM::getVariableReferenceFromNode (10823): requested node ID (0) not found
Time:12/26/2020 16:45:21
Call trace:
  Script RideObjectClassMethods line 62 me[id=1000001461 class=_stateActionCallScript]
  Script _StateActionCallScriptClassMethods line 23 me[1000001461]
  Script _StateActionClassMethods line 48 me[0]
  Script MarshalUtils line 423 me[0]
  Script MarshalUtils line 397 me[0]
  Script MarshalUtils line 170 me[0]
starting method/function _RECEIVEMARSHALLEDNODECOPY
starting me[id=0 invalid]




of what i understand its because it doesn't find the rider pointer in my onDoStateAction

Code: [Select]
shared function _OnDoStateAction( action as NodeRef of Class _StateAction )
  acct as NodeRef of Class E_playerAccount = GetAccountID()
  acct.ridePointer = GetAccountID()
  ride as NodeRef of Class RideObject = acct.ridePointer

  object as NodeRef = getObject(action)
  ObjLocate as Vector3
  GetNodePosition(object, ObjLocate)

  direction as String = getDirection(action)
 
  // save current object we are riding
  println("riding "+object+"  Dir "+direction)
  acct.ridePointer.rideDirection = direction    //here is where the error shows up, here's line 62
  acct.ridePointer.rideNode = object
  acct.ridePointer.ridePosition = ObjLocate
.

also i attached the screenshot of my DOM showing how my class does contains the ridePointer also i change the detect elevator function as i don't have the function getChatPointer in my MiscUtils

// var player = MiscUtils:getCharPointer()


Code: [Select]
public function DetectElevator(Accc as NodeRef of Class TWW_ACCController)
 // var player = MiscUtils:getCharPointer()
 
  char as NodeRef = Accc
  origin as Vector3
  GetNodePosition(char, origin)

   
   
  acct as NodeRef of Class E_playerAccount = GetAccountID()
  acct.ridePointer = GetAccountID()
  ride as NodeRef of Class RideObject = acct.ridePointer

  direction as Vector3 = (0,-1,0)  // detect below player
  intercept as Vector3
  distance as Float = 0.2          // detect upto 2 meters (0.2 units)
  meshName as String

  excludedNodes as List of NodeRef
  add back char to excludedNodes

  if ride.rideNode <> None
    GetNodePosition(ride.rideNode, ride.ridePosition)
   
    hit as NodeRef = Raycast3D(origin, direction, excludedNodes, distance, intercept, meshName)
    if intercept != (0,0,0)
      if ride.rideDirection = "up"
        check as Vector3
        check.y = ride.ridePosition.y + 0.05      // need 0.05 or player falls thru
          if origin.y < check.y                   // check player is above fall thru distance
            origin.y = check.y
          .
      .
      SetNodePosition(GetAccountID(), origin)
    .
  .

  // debug line to show direction of check
//  DrawDebugRay(origin, origin + (direction * 10), 0.05, "FF0000", "FF0000", 1.0, false)
//  if intercept != (0,0,0)
//    DrawDebugPoint(intercept, 0.1, "00FF00", 1.0, true)
//  .
.


thanks i hope you answer my question hope you are doing well

5
i want to make that the main camera (GAME) can zoom until the center of the character that way offset would be 0.0 and you could see from inside the head of the character.

i get very far in the code and i didn't found why the GAME camera can't get closer to the character. it always stops at offset 0.094

the other way would be create from 0 another camera like FP_Camera or something. new cameras can be in 0.0 offset

Please i need your help, thanks   ;D


https://gyazo.com/3af95d21634ed4e98942d39992a9af0b

Pages: [1]