Jump to content

Attaching an object to an actor


Drazhar753

Recommended Posts

So basically, I am trying to figure out if there is a way to attach an object, such as a movablestatic to an actor. Much like how Setvehicle() works but reversed I suppose, instead of the actor being stuck to that object the object would instead be stuck to the actor, and simple move with them. Is there a way to do this? I know Game.AddHavokBallAndSocketConstraint is a thing but it requires the actor to be in ragdoll mode, or mounted on a horse... So that's no good in this case.

 

I thought about AnimObjects, is there a way to 'get' them via script whilst their animation is playing? Basically I am trying to find a way to make an actor 'carry' another actor, and I figure if I can attach a movable static to an actor, then setvehicle another npc to that attached static, voila. I've tried things such as translating to on a loop, but its janky as hell as expected. SetVehicle on both actors to the same static, and then moving the static via translateto works... but its still not quite what im after since they are sliding and their destination has to be controlled via script.

Edited by Drazhar753
Link to comment
Share on other sites

  • 6 years later...

Too long time passed, however, for someone searched this thread like me, I have a running script for this.

1...

ForceAddRagdolltoWorld()  works for AddHavokBallAndSocketConstraint() , even in animation-driven state like in walking, in combat animations, in idles.... 

multiple articulation is available (like, left hand to right forearm & head to spine0 & right hand to left leg, all simultaneously, total actors more than 2 is able )

-----------------------------------------------------------------------------------

actor me

actor carrythis

me.ForceAddRagdolltoWorld() 

carrythis.ForceAddRagdolltoWorld()

AddHavokBallAndSocketConstraint( carrythis , "NPC L Hand [LHnd]", me, "NPC R Hand [RHnd]" ) ;;if both node names are correct & both have collision node in NIF

;;;and then they could do something in 'handshake state';

;;;;doing separate things will constraining each other ;

RemoveHavokConstraints( carrythis , "NPC L Hand [LHnd]", me, "NPC R Hand [RHnd]" ) ;; me.ForceRemoveRagdollFromWorld() or carrythis.ForceRemoveRagdollFromWorld() works anyway

---------------------------------------------------------------------------------

2....

It can get hand or some body part constraints, and physically pull each others.

But still their main 'Locations' is fixed to their animation-driven axis in skyrim.

PushActorAway(~, ~) could be continuously used on that actor to be dragged, but it cause dragging damage and too much fluttering and shaking,

even cannot control dragged actor's body angle ( setangle(), translateto() --these won't work because not fixed posture in animation-driven or setrestricted()/setdontmove() state ).

(even worse is, whenever pushed actor get a chance of returning to non-ragdolling state while 'handshake' is on, it cause determined CTD)

3.....

Call an object and setvehicle on it <---this worked along with 'handshakes' 

I used these elements:

--------------------------------------------------------------------------------------

Form property FormactivatorA  auto ;;use NIF mesh containing animstatic or static collision type ;; translateto()/setposition() does not always work for dynamic gravity collision meshes ;

actor me

actor carrythis

Objectreference activatorAAA = me.placeatme(FormactivatorA)

carrythis.SetVehicle(activatorAAA)

while true ;;_while_something_your_condition_

  activatorAAA.SplineTranslateToRefNode( me , "NPC R Hand [RHnd]" , 1.0, 65536.0 * 64.0  ) 

  ...

  wait(0.01)  ;;_need_to_update_wait_too_short_time_smaller_than_1/60_FPS_, or increase time/decrease translate speed until you like it

endwhile

...

carrythis.SetVehicle(carrythis)  

carrythis.setscale(1.0)           ;;because sometimes scale shrink or zoomed

------------------------------------------------------------------------------------

 

Edited by asdsad121
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...