skyrim-multiplayer / skymp

Multiplayer Mod & TypeScript SDK for Skyrim Special Edition
Other
220 stars 75 forks source link

Add support for setting/getting 3D world position of text and attaching text to ObjectReference #1504

Open Pospelove opened 1 year ago

Pospelove commented 1 year ago

Description:

We currently have support for creating, manipulating, and fetching various attributes of 2D text elements in our application, but there is a need to further extend this functionality. Specifically, we need to enable users to:

Set and get the 3D position of a text element in the world space. Attach a text element to an ObjectReference, optionally specifying a node (e.g., head node) and a 3D offset from the specified node.

This API, when will be used, will help our client survive in case of 100-1000 objects/players with nicknmaes without significant performance loss. The main thing is that we move texts draw logic from JavaScript to C++

Implementation Details:

This requires the addition of the following methods:

setTextPos3D(textId: number, pos: number[]): void;
getTextPos3D(textId: number): number[];
attachTextToObject(textId: number, objectReference: ObjectReference, node?: string, offset?: number[]): void;
setDrawDistance(textId: number, drawDistance: number): void;
getDrawDistance(textId: number): number;

Corner Cases:

There are several considerations and potential corner cases that should be kept in mind:

Documentation:

All new functions should be fully documented. Also, usage examples should be provided. + changelog

depends on #1503

See also

https://github.com/skyrim-multiplayer/skymp/blob/82e4d2fc5c4d3601036bd7686f56932260a0cd1a/skymp5-client/src/view/formView.ts#L390C56-L390C56

github-actions[bot] commented 6 months ago

This PR/issue depends on: