Skip to content

Wrapper for SetObjectVisualTransform

Asked something similar before, but does anyone have a wrapper solution for SetObjectVisualTransform, so it can be used with DelayCommand?

Comments

  • KamirynKamiryn Member Posts: 74
    edited November 2023
    void FloatToVoid(float fValue) {};
    
    DelayCommand(fDelay, FloatToVoid(SetObjectVisualTransform(...)));
    

    or
    void MySetObjectVisualTransform(...)
    {
    	SetObjectVisualTransform(...);
    }
    
    DelayCommand(fDelay, MySetObjectVisualTransform(...));
    
  • TarotRedhandTarotRedhand Member Posts: 1,481
    edited November 2023
    I have a whole set of them. On the downside, they were created before lerping was created. On the plus side all the parameters for lerping have default values. So if you don't need lerping, the functions I created should work. On the other hand if you do need lerping you'll have to add the parameters yourself. So take a look and see if any the functions here suit your needs. BTW, you didn't say which transform type(s) you needed so the following code does all of them.

    // set of 16 wrapper functions for the SetObjectVisualTransform() function that all 
    // return void which means that they can be used with DelayCommand()
    // consists of 1 private function and 15 public ones
    //
    // Purpose: To simplify usage and translate the mathematical terms used into English 
    //         (Translate = move)
    //
    // Assumes that no Lerping is required
    //
    
    //
    // function prototypes
    //
    
    // private function used by both move and rotate functions where more than one 
    // direction is to be acted upon.
    void DoTransform(object oObject, int nTransform, float fValue);
    
    // Scale() changes the size of an object without changing its location
    void Scale(object oObject, float fValue);
    
    // MoveX() moves an object along the X plane
    void MoveX(object oObject, float fValueX);
    
    // MoveY() moves an object along the Y plane
    void MoveY(object oObject, float fValueY);
    
    // MoveZ() moves an object along the Z plane
    void MoveZ(object oObject, float fValueZ);
    
    // MoveXY() moves an object along both the X plane and the Y plane
    void MoveXY(object oObject, float fValueX, float fValueY);
    
    // MoveXZ() moves an object along both the X plane and the Z plane
    void MoveXZ(object oObject, float fValueX, float fValueZ);
    
    // MoveYZ() moves an object along both the Y plane and the Z plane
    void MoveYZ(object oObject, float fValueY, float fValueZ);
    
    // MoveXYZ() moves an object in all 3 planes
    void MoveXYZ(object oObject, float fValueX, float fValueY, float fValueZ);
    
    // RotateX() rotates an object about the X axis
    void RotateX(object oObject, float fValueX);
    
    // RotateY() rotates an object about the Y axis
    void RotateY(object oObject, float fValueY);
    
    // RotateZ() rotates an object about the Z axis
    void RotateZ(object oObject, float fValueZ);
    
    // RotateXY() rotates an object about both the X axis and the Y axis
    void RotateXY(object oObject, float fValueX, float fValueY);
    
    // RotateXZ() rotates an object about both the X axis and the Z axis
    void RotateXZ(object oObject, float fValueX, float fValueZ);
    
    // RotateYZ() rotates an object about both the Y axis and the Z axis
    void RotateYZ(object oObject, float fValueY, float fValueZ);
    
    // RotateXYZ() rotates an object about all 3 axes
    void RotateXYZ(object oObject, float fValueX, float fValueY, float fValueZ);
    
    //
    // Actual functions
    //
    
    //
    // Private function - Do not call outside of this library
    //
    
    void DoTransform(object oObject, int nTransform, float fValue)
    {
    	float fDummy = SetObjectVisualTransform(oObject, nTransform, fValue);
    }
    
    //
    // Public functions - use these instead
    //
    
    void Scale(object oObject, float fValue)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_SCALE, fValue);
    }
    
    void MoveX(object oObject, float fValueX)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, fValueX);
    }
    
    void MoveY(object oObject, float fValueY)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Y, fValueY);
    }
    
    void MoveZ(object oObject, float fValueZ)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z, fValueZ);
    }
    
    void MoveXY(object oObject, float fValueX, float fValueY)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Y, fValueY);
    }
    
    void MoveXZ(object oObject, float fValueX, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z, fValueZ);
    }
    
    void MoveYZ(object oObject, float fValueY, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Y, fValueY);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z, fValueZ);
    }
    
    void MoveXYZ(object oObject, float fValueX, float fValueY, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Y, fValueY);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_TRANSLATE_Z, fValueZ);
    }
    
    void RotateX(object oObject, float fValueX)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_X, fValueX);
    }
    
    void RotateY(object oObject, float fValueY)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Y, fValueY);
    }
    
    void RotateZ(object oObject, float fValueZ)
    {
    	float fDummy = SetObjectVisualTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Z, fValueZ);
    }
    
    void RotateXY(object oObject, float fValueX, float fValueY)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Y, fValueY);
    }
    
    void RotateXZ(object oObject, float fValueX, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Z, fValueZ);
    }
    
    void RotateYZ(object oObject, float fValueY, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Y, fValueY);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Z, fValueZ);
    }
    
    void RotateXYZ(object oObject, float fValueX, float fValueY, float fValueZ)
    {
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_X, fValueX);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Y, fValueY);
    	DoTransform(oObject, OBJECT_VISUAL_TRANSFORM_ROTATE_Z, fValueZ);
    }
    

    TR
  • TheTinmanTheTinman Member Posts: 74
    This will also work.
    void floatDelay(float ms){}
    
  • nwfan87nwfan87 Member Posts: 99
    @Kamiryn @TarotRedhand @TheTinman Thank you all very much for your solutions, will give appropriate credit. @TarotRedhand Of all things, yes I'm using lerps, but can probably work that out myself as you said.
Sign In or Register to comment.