In the past soemone did have me this line. because i could not figure out how. Now i decided to test that line in sansar. But you cannot do vector*quart.

This the line i used in SL. This the center line i used.

newpos = curpos-<0.0 ,0.0 , 0.0>*rot;

Now i would think, easy to convert. so i made this code.

`Quaternion rotation = RigidBody.GetOrientation().Normalized();Vector currentposition = RigidBody.GetPosition(); Vector centerposition = currentposition-new Vector(0.0f ,0.0f , 0.0f)*rotation;textChat(centerposition.ToString());But i get a Error;Just got a smart idea.Vector centerposition = currentposition - new Vector(0.0f * rot.X, 0.0f * *rot.Y, 0.0f * rot.Z);`

But no, then where stuck with pointer errors. Reminds me at the pascal time and pointers.

Lost, i know this same one i could not figure out on other platform to. What it's doing at the end. is give you the start position of object and the end position on all axis. and the one above i used for the center. that way.

• Richardus Raymaker

Galen is right, i 'try' to make object the follow a path. mabye soemday it can carry avatars. but it not follow a avatar like a dog :)

• Richardus Raymaker

Made first step for my own documents And i made the following 3 examples.

`Convert Quaternion to Radian.Quaternion rot = RigidBody.GetOrientation();Vector rotRad = rot.GetEulerAngles();Log.Write("rR:  " + rotRad.ToString());Convert Quaternion to Degree.Quaternion rot = RigidBody.GetOrientation();Vector rotDeg = rot.GetEulerAngles() * Mathf.DegreesPerRadian;Log.Write("rD:" + rotDeg.ToString() );From Vector(degree) to QuaternionQuaternion rotQuat = Quaternion.FromEulerAngles(new Vector(0f,0f,90f));Log.Write("rQ:  " + rotQuat.ToString());`
Edited by Richardus Raymaker
• Gindipple

Is it a bug?

A valid question, It changed how it works this build without any documentation.

It now works different depending on if in 1st person and in 3rd person.

So I'll put it to you, Is that a bug? And if not what would you call it?

• Galen

Third part doesn't do the proper conversion from degrees to quaternions. It should be like this:

`Quaternion rotQuat = Quaternion.FromEulerAngles(  new Vector(0f, 0f, 90f) * Mathf.RadiansPerDegree);`
• Galen

@Gindipple: It seems like a bug fix to me.

• Gindipple

So you think they should report different values in 1st person and 3rd person?

And that it's named CameraForward it should not really give you the vector corresponding to the position that you are looking at with the Camera?

You really want to call that a bug fix?

• Richardus Raymaker

@Galen. How is your FromLook going. I just tried this in CoRoutine. and i have other CoRoutine that moves the object. But as soon i go enable RigidBody.SetOrientation(Ori); in my script the movement stops and nothing happens. Or Log.Write just refuse to write to the log console.

Now i did assume it's working with degree. But i think am doing soemthing wrong. looking tomorrow at it. because i have my favorite NaN again. means i put some where negative numbers into the count.

error message Fail turn
error message (NaN,NaN,NaN,NaN)

Anyway, this the test code i used.

`        {            try            {                Vector Dir = new Vector(0,(float)turncount,0);                Quaternion Ori = Quaternion.FromLook(Dir, Vector.Up);                Ori *= Quaternion.FromEulerAngles(Dir);                Log.Write(Ori.ToString());                RigidBody.SetOrientation(Ori);                turncount++;                if (turncount>359) { turncount=0; }                Wait(TimeSpan.FromSeconds(5));            }            catch (Exception)            {                Log.Write("Fail turn");            }        }`

• Gindipple

And you're back to using degrees why?

*bonks Richardus on the head*

• Richardus Raymaker

Can i blame Sansar documentation for doing that ?
The talk about vector, and for my a vector is still automatic degree. Mabye we need to blame Secondlife for that.

It would be nice if Sansar did add in the documentation if the want a Vector degree or Vector radian.

I think where close to where i always go wrong. I where already in doubt if it's degree or radian. Galen, i try it tomorrow with radian. To tired now, and that is the other possible problem.

• Richardus Raymaker

Did changed and done a quick test with radian. But not much difference. Still NaN error and Catch. Tomorrow a new day.

ADD: Disable: //Ori *= Quaternion.FromEulerAngles(Dir); does not help.

`        while (true)        {            try            {                Vector Dir = new Vector(0,turncount,0);                Quaternion Ori = Quaternion.FromLook(Dir, Vector.Up);                Ori *= Quaternion.FromEulerAngles(Dir);                Log.Write(Ori.ToString());                RigidBody.SetOrientation(Ori);                turncount = turncount + Mathf.RadiansPerDegree;                if (turncount > Mathf.TwoPi) { turncount = 0; }                Wait(TimeSpan.FromSeconds(5));            }            catch (Exception)            {                Log.Write("Fail turn");            }        }`
Edited by Richardus Raymaker
• Gindipple

You are all over the map here.

I know what you are trying to do, but I really don't want to do it for you as you will not learn that way.

So I try to give pointers in the right direction instead.

Step back and ask yourself, do you want to slowly incrementally rotate something or do you want a snap rotate to it instantly. Because what I see is you trying to employ both concepts into one thing here.

incrementing by a conversion factor is not what you want.

`turncount = turncount + Mathf.RadiansPerDegree;`

Putting a angular amount of turn into a direction vector for FromLook is not what you want.

`Vector Dir = new Vector(0,turncount,0);`

In my carpenter a-n-a-l-ogy remember I converted into metric and back out.

You can use degrees and radians, you just have to know when to switch from one to the other. For example if you wish to slowly rotate something you might think in terms of degrees, maybe increment by 2 degrees, just remember to switch it to radians for the computer to handle in the methods that are going to call trig.

so you might do like turn += 2;

and then later when you use the turn you might do Mathf.Cos( turn * Mathf.RadiansPerDegree )

this way you retain the degree conceptually but allow the computer to operate on the angle the way it will understand it best.

Edited by Gindipple
• Galen

@Richardus: This is wrong in so many ways. I don't think I can school you much more on this because it seems you are struggling with the basic concepts involved.

Sorry, my friend. I think you need to step away from your application goals and try simpler experiments that take you toward your goal in much smaller steps. And probably take some time to study vector math introductory texts along the way. This stuff is complex enough for those of us who know it well. It's daunting for people new to it.

• Galen

@Gindipple: I think they necessarily must behave differently. When you are in first person mode, it's clear that what you are looking at is at the center of the screen. When you are in third person mode, there is usually a disagreement between what your avatar is looking at and what is in the center of your screen. The easiest way to resolve it is to favor what the avatar seems to be looking at. And in that context, it's easiest to assume that your avatar is looking at the horizon in the direction it is facing and not up or down in azimuth.

• Richardus Raymaker

Gindipple. i look tomorrow at it, i just did small steps in 1 degree. in this test script to see how fromlook works. Ohh. cos.

Galen, hmm not sure. It's lack of correct documentation and strange thinking on my side.

If sansar would have made linear velocity robust and not Grabbable and more resistant to object it's . things where better in many ways. Lack of working examples from sansar made me to go in the trail and error direction to learn it.

• Gindipple

Well we're just going to have to agree to disagree on that Galen.

If you're right then at the very least they changed it without telling us at all.

That in itself is wrong and I do hope they change it back.

Keep at it Richardus, I will be disappointed if you give up. But do take a step back and work on smaller concepts first. Not shotgun randomness trial and error :)

Be methodical and research oriented in your trails.

And as Galen said, set your longer term goal aside for a bit.

Come back to it with a solid foundation. A refresher course in trigonometry might be a decent start. I say this because I see you struggling with radians.

Their documentation isn't terrible on this, yes they could use some more examples, but you can't pin this one on them :)

• Richardus Raymaker

Rule 1: Do not work with good at the evening :O

I just looked a minute on the code from yesterday and i see i put radian where it need to have a quat same with vector. So i need to look at that first.

• Gindipple

You should go look over at the Scripting Challenge thread I did, you inspired me to do that

It's my way of saying we shouldn't just blindly use a routine that we can't write ourselves.

It's important to really know what a simpler routine does for us.

Like using the power rule in calculus, first they teach you the long way, then they give you the shortcut.