Smooth rotations

Raylectron (https://Raylectron.com) is a 3D rendering engine for Trimble Sketchup (https://sketchup.com)
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

very bizarre! :o
Render.7z
(36.08 MiB) Downloaded 1752 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

It works fine on the same model that you sent me like a week ago but not on this one. So it seems like the component axis has changed in Sketchup, when you modified the model? In Sketchup, right click the 302 and select Change Axis to make sure it's at the right place and the axis are aligned correctly, sitting in the cockpit, red pointing right, green pointing forward and blue pointing up.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

Hmm, yes that could have been the issue. I've re-orientated the model now, so we'll see how we go. :salute :mrgreen:
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

:salute
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

A few issues. But it's a great start. I'll let you see what we can change to fix it :mrgreen:
new runway-test.mp4
(49.09 MiB) Downloaded 1811 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

Looks good, just the turning left is a bit too late and the stop is too early, and maybe the takeoff is too soon, but that's all about changing the seconds in the functions.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

BTW, after you have reset the orientation in Sketchup, did you remove py := -py; from the script?
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

I do need to work out in my head the timing (seconds). I did remove the py yes.

After the take off, you'll notice when it goes up, rather than increase the angle of flight, it tends to flatten out, instead of upwards.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

Yes it looks that way, but I think it's because of the viewing angle of the camera. I'm not sure but I'll check it out by placing the camera elsewhere...brb
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

I can't test this properly because I only have the model with the wrong axis.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

Render.7z
(37.35 MiB) Downloaded 1818 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

It's working fine, it stays at that angle until the video ends. So it's a camera angle view thing. Beside, it's only a 30 deg climb.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

how do I change the camera angle? And increase the last angle to 50 degrees? I'd like to also have it sit there for 10 seconds before it starts the take off. Can we do that?
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

Yes, you can do all that, it's just the timing and distances that you have to set. Follow the code and adjust to what you want.

After all the blinking commands, you have...

Accelerate(py, 40, 2, 27);

which makes the 302 accelerate for a distance of 40 meters from 2 seconds to 27 seconds. But then, you have...

DistDecelerate(py, 25, 27);

which makes it decelerate to a stop for a distance of 25 meters and to do it starting at 27 seconds.

The comes the left turn...

Yaw(-90, 30, 40);

90 deg total and it starts to turn at 30 seconds and will stop turning at 40 sec.

Then 2 seconds later, at 42 seconds, you have...

Accelerate(py, 30, 42, 43);

which will make it accelerate 30 meters in 2 seconds and stay at that speed.

Then at 46 seconds, it nose up 35 degree in 3 sec and then stays at the angle.

Pitch(35, 46, 49);

So just change the timing of the events.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

I can follow that :D

Yaw(-90, 30, 40);

90 deg total and it starts to turn at 30 seconds and will stop turning at 40 sec.

Then 2 seconds later, at 42 seconds, you have...

Accelerate(py, 30, 42, 43);

To make it sit there longer. Could I change 42 to 52?

then in the climb
Then at 46 seconds, it nose up 35 degree in 3 sec and then stays at the angle.

Pitch(35, 46, 49); how would I add a change to 50 deg after a few moments? (say 3 seconds at 35 deg)
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

GateGirl86 wrote: Thu May 25, 2023 3:47 pm Accelerate(py, 30, 42, 43);

To make it sit there longer. Could I change 42 to 52?
no because that's the "start at" and 52 is the "end at" and that's the acceleration.

//Then 2 seconds later, at 42 seconds, you have...
//Accelerate(py, 30, 42, 43);

That's the part where it sits for 2 seconds before accelerating again, so if you want it to sit there for an additional 8 seconds, you need to add 8 to the 42 and 43. Then any other functions after that, also need to be adjusted by adding that 8 extra seconds to Pitch(35, 46, 49); as well, so that would be Pitch(35, 46+8, 49+8);
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

Got it!

after the pitch, could I add.

Pitch(50, 62, 68);
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

absolutely :salute
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

:salute

wish me luck :mrgreen:
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

Good luck :mrgreen: :salute
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

*fail* I know I shouldn't get emotional over these things, but I do. I hate failure. I totally screwed this one up???
Render.7z
(37.35 MiB) Downloaded 1813 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

You did just fine :salute , you only forgot to update the timing in this one...

if (sec >= 48.0) and (sec <= 48.0) then
CamRotX := -12.0/(2.0*fps);

make that 58,78 or whatever instead of 58, 58

This line takes care of orienting the camera up before making it go forward because it's pointing downward and moving it forward will follow to downward path.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

I've changed a few numbers because the Yaw was happening while the 302 was not really moving and lowered the value for the camera looking up. Also, you should change the axis of the 302 to be in the middle of the 2 back wheels so it looks realistic when it turns on the runway.

Code: Select all

Units := Meters;

BlinkLight('emitter_blue_tailight', 1.0, 0.0, 999.0);
BlinkLight('emitter_stb_nav',       1.0, 0.0, 999.0);
BlinkLight('emitter_port_nav',      1.0, 0.0, 999.0);
BlinkLight('emitter_nav_light',     1.0, 0.0, 999.0);

Accelerate(py, 35.0, 2.0, 35.0);

DistDecelerate(py, 35.0, 48.0);

Yaw(-90.0, 35.0, 45.0);

Accelerate(py, 30.0, 58.0, 59.0);

if (sec >= 58.0) and (sec <= 78.0) then
  CamRotX := -8.0/(2.0*fps);

if (sec >= 58.0) and (sec <= 68.0) then
  CamPosY := py / 1.3;

Pitch(35.0, 62.0, 63.0);

if (sec >= 62.0) and (sec <= 63.0) then
  CamRotX := 0.0/(3.0*fps);

Pitch(50.0, 68.0, 69.0);
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: Smooth rotations

Post by GateGirl86 »

Almost got it!!!! :mrgreen:

It just disappears for a moment to the left of screen and doesn't quite leave the frame, instead just vanishes in mid air (might have got taken by the Asgard)
new runway-test.mp4
(45.58 MiB) Downloaded 1792 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3459
Joined: Sun Oct 02, 2011 10:49 am

Re: Smooth rotations

Post by Support »

oh that's nice :salute

and to rotate the camera to see more the left, the end of the script, you have something like this...

if (sec >= 62.0) and (sec <= 63.0) then
CamRotY := 1.0/(3.0*fps);

but it's CamRotX := 0.0/(3.0*fps);

so if you use that one instead and tuned it, it's going to be awesome, well Done "Sam" :salute :salute :salute
Your support team.
https://SoftByteLabs.com
Post Reply