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 :)