@Ray_Rune is saying the same thing I did. Yes, this is the best method. The zoom has nothing to do with the rotation. Rotation is rotation. Simply track the mouse location left/right and let the linear interpolate handle the spin. This is very easy to do and is very player/designer friendly.
Tip:
*A small additional note on the script/object communications. You will want to make a general use scene object (not rendered at 0,0,0) that handles general scene stuff. Like tracking the mouse position, mouse click, keyboard stuff…time…scene stuff. Listener Objects will cache this/these objects and listen for the data they will need. In this case the Sphere/Planet needs Mouse Down and Left/Right info. It will always be listening (some call these events but works differently). It is important to set up this early in design to make things easier down the road. It is very much worth the time doing this prior to testing things/ideas. Flax has some Find Object/Actor options (a lot to be honest) and there is a forum topic asking which is best. Use that to store/cache the object reference for easy access. Only need to do this if the OBJECT_TYPE_INVALID check is True (Object is null). And yes sometimes the memory cache gets emptied so you might need to Find again during runtime. *
Quote: I think there are some your own private codes, which is not presented here, not presumable trivially…
No. Those are the entire functions and everything within them is math. They need to be in a static class. Maybe you have never done this before?
I will be explicit below if someone reading this is not familiar with doing this sort of thing. If you have not, it is super powerful, saves enormous amounts of programming time, and once tested zero bugs ever. Can mix and match your parameters. In fact the general programming rule is…if you are using the same code and pasting it more than twice then the code logic should go into a function with parameters.
C++ will be similar, but I am not using the C++ side yet.
C# Ref:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/namespace
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/method-parameters
The method parameters can be a little confusing but the examples are there. The examples are not combining the class being located in the namespace keyword. Also try to avoid the nested namespace.
It is a good idea to make your namespace (‘Include’) scripts have a unique prefix so they are not confused with internal engine functions/features. Sometimes the name of the function can be similar. In my case everything is prefixed with a g for Genesys Framework. The functions will always have the gScript.Function format so it is very easy to know where the function is coming from.
I am not sure what the limits are on parameters, but it is a lot.
Script.Function(Parameter1, Parameter2, … , Parameter10)
script name: gIO_Math.cs
namespace gGenesys
{
public static class gIO_Math
{
// Some Float Function with Parameters
public static float CustomFloatFunction(float fVariable1, float fVariable2, int nVariable3)
{
return fVal;
}
// Some Int32 Function with Parameters
public static int CustomInt32Function(int nVariable1, int nVariable2, float fVariable3)
{
return nVal;
}
// Some non-static class within the declared public static class (include script)
public class Timer
{
public float SomeTimerFloat
{
get
{
}
private set
{
}
}
}
}
}
Calling these functions in a script:
At the top of each script you need your namespace.
using FlaxEngine;
using gGenesys;
Above functions as example.
fRotZ = gIO_Math.DampenFloatByLevel(1.123, 2.123, 3);
1.123 = Should be some variable like Rotational Value (it is a Float)
2.123 = Same. Should be the Rotational Angle Target variable (Mouse Left/Right)
That is enough blabber and details from me. I hope it help and clarifies some things.
Cheers
O