Page MenuHomeFeedback Tracker

[Feature Request] - LinkToLocalSpaceOf allow attach to specific bone
Closed, ResolvedPublic

Description

My proposal is extend LinkToLocalSpaceOf by optional parameter - bone. It will allow implement for example horse. When player sitting on the horse's back, it should move up and down as the back bones of the horse move, for example, when the horse gallops or runs.

My proposal:

proto native	void		LinkToLocalSpaceOf(notnull IEntity child, vector pLocalSpaceMatrix[4], int bone);

Not sure if AddChild will works without glitches when want attach player to animal.

Details

Severity
None
Resolution
Open
Reproducibility
N/A
Operating System
Windows 7
Category
General

Event Timeline

Hunterz created this task.Sep 18 2022, 10:47 AM
Geez changed the task status from New to Assigned.Sep 19 2022, 1:19 PM

This works in offline:

	void AttachPlayer(PlayerBase player)
	{
		Object obj = this;

		vector tmPlayer[4]; 
		vector tmTarget[4];
		vector tmLocal[4];
		player.GetTransform( tmPlayer );	
		obj.GetTransform( tmTarget );
		tmPlayer[3] = tmTarget[3] + Vector(0, 0, 0);
		Math3D.MatrixInvMultiply4( tmTarget, tmPlayer, tmLocal );
		if (!player.GetParent())
		{
			player.LinkToLocalSpaceOf( obj, tmLocal );
			obj.RemoveChild( player );
			player.SetOrientation("90 0 90"); //90 -90 90
			obj.AddChild( player, 16 );	
		}
	}

But not works in server environment. My Goal is this behavior (player attached to specific bone of parent animal or entity in general):

Geez closed this task as Resolved.Mar 17 2023, 11:44 AM
Geez claimed this task.
Geez added a subscriber: Geez.

Hello Hunterz.
The code you mentions work offline will work in online environment with the update 1.21.
In 1.21, the pivot and positionOnly flags called from 'IEntity.AddChild' will now synchronize in multiplayer.

Regards,
Geez

Thank you! This message made my day. Another step close to horse :)

after more deep testing, method with addchild is useless, I also found another issue with client simulation: T186298

Geez added a comment.Mon, Nov 11, 10:45 AM

Try calling 'dBodyActive(player, ActiveState.INACTIVE);' and 'dBodyEnableGravity(player, false);' after performing 'LinkToLocalSpaceOf'. When the player is active, it will still attempt to do some simulation which will force it to always align upwards.

Gravity already disabling, but that deactivation body helps! Thank you so much. Mentioned ticket can be closed as solved. Many thanks again, now is movement of rider on horse much better even during horse turning