New function in animator

Raylectron (https://Raylectron.com) is a 3D rendering engine for Trimble Sketchup (https://sketchup.com)
Post Reply
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

New function in animator

Post by Support »

Here is the RBZ download and description after

https://Raylectron.com/files/Raylectron.rbz

I've modified the rotation so that it's not linear, it was too robotic. Now it starts slower and end slower, very smooth.

Instead of setting the acceleration and rotation manually, you can now simply use the following functions...

Code: Select all

Roll(Angle, StartAt, EndAt);
Pitch(Angle, StartAt, EndAt);
Yaw(Angle, StartAt, EndAt);

py := Accelerate(Value, Units, StartAt, EndAt);
Where StartAt and EndAt are when (in seconds including decimals) in the video you want to take that action. Angle is in degree.

For the acceleration. Value and Units is the distance per seconds. Units can be Inches, Feet, Meters, Millimeters and Centimeters, and it will automatically convert the result to Inches for the px, py or pz that you use the function for. Example:

Code: Select all

// Accelerate 0.254 meters per second starting at one second into the video and end the acceleration at 15 seconds and keep a steady speed.
py := Accelerate(0.254, Meters, 1, 15);

// at 15 seconds, start to roll so that at 19 seconds, it will has rolled 90 degrees.
Roll(-90, 15, 19);
// at 19 seconds, pitch 180 degree within 4 seconds.
Pitch(180, 19, 23);
// at 19 seconds, roll 90 degree back withing 5 seconds.
Roll(90, 23, 28);
I hope this makes it easier :salute

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

Re: New function in animator

Post by GateGirl86 »

It will make it a lot easier for me. I'm such a dummy when it comes to this sort of thing. :lol:
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

GateGirl86 wrote: Wed Apr 26, 2023 5:32 pm It will make it a lot easier for me. I'm such a dummy when it comes to this sort of thing. :lol:
:( The lack of knowing something does not make you a dummy and in no time you'll be making spectacular animations.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

Yes I know! :mrgreen:
Image
"Come with me if you want to live."
Sarah Connor
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: New function in animator

Post by Okwa »

Wow, you really went out of your way to make it easier for us. Thank you for the work. :salute I will try this out as soon as I can.
Okwa
Posts: 486
Joined: Mon Feb 27, 2023 1:34 am

Re: New function in animator

Post by Okwa »

One question: What is the command for Stop, after acceleration? I tried the Acceleration 0 command, to be exact:
pz := Accelerate(3, meters, 1, 2);
pz := Accelerate(0, meters, 3, 10);

but then the model does not move at all, as if Raylectron ignores the first command.

EDIT:
Forget my question. Thinking for yourself makes you smart. :lol:
if sec < 3 then
pz := Accelerate(3, meters, 1, 2);
if sec >3 then
pz := Accelerate(0, meters, 3, 10);
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

oh, I forgot to explain...

The Accelerate command returns zero if the current seconds is less than "Start" and returns the acceleration that was calculated at 'End", so...

1. pz := Accelerate(3, meters, 1, 2);
2. pz := Accelerate(0, meters, 3, 10);

if sec <1 then py for #1 is zero, and if sec >= 1 and sec <= 2 then pz will be set to the calculated acceleration in #1 but then, in #2 , it will set pz to zero because its acceleration is zero.

To make it stop, set pz to zero.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

Another way you can have more control...

Code: Select all

// here we set 2 variables for the acceleration we need...
Acc1 := Accelerate(1, meters, 1, 3); // set to zero if sec < 1 and full acceleration at sec >= 3
Acc2 := Accelerate(1, meters, 10, 15);  // set to zero if sec < 10 and full acceleration at sec >= 15

// if sec is less than the start for acc2, keep using acc1...
if sec < 10 then
  pz := acc1;

// Slow down to a stop after 10 sec...
if sec > 10 then begin
  // subtract new acceleration from current...
  pz := acc1 - acc2;
  // this just make sure it doesn't start to go backward after 15 sec...
  if pz < 0 then
    pz := 0;
end;
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

I think I'm ready to get this started now :mrgreen:

Is it possible to move the 302 forward, then turn 90 degrees smoothly to the left to stop, then slowly roll forward and gradually lift off when we reach take off speed (around 160kmh).

I've changed the grass to concrete and I think that looks much better.
new runway1.png
new runway1.png (2.4 MiB) Viewed 16588 times
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

Yes it does look way better this way, it looks very serious, I like it like this.

Can you go back to Sketchup, click on the 302 and see it's a component or a group. If it's a group, right click it and convert it to a component. Right click it again then select Change Axis, place the axis in the middle of the 302, that will be the point it will rotate about. Then tell me what color are the axis and where do they point, like, res is left wing to right wing, green is front to back and blue up and down.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

I'll have to shut down the render. And yes it is a component. :mrgreen: I'll come back later today and let you know.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

the axis is now in the centre of the 302 on the surface of the runway. Red is to the starboard wing, green is to the front and blue is up.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

ok, start with this script and then ask me questions...

Code: Select all

// here we set 2 variables for the acceleration we need...
Acc1 := Accelerate(1, meters, 1, 3); // set to zero if sec < 1 and full acceleration at sec >= 3
Acc2 := Accelerate(1, meters, 10, 15);  // set to zero if sec < 10 and full acceleration at sec >= 15

// if sec is less than the start for acc2, keep using acc1...
if sec < 10 then
  px := acc1;

// Slow down to a stop after 10 sec...
if sec > 10 then begin
  // subtract new acceleration from current...
  px := acc1 - acc2;
  // this just make sure it doesn't start to go backward after 15 sec...
  if px < 0 then
    px := 0;
end;

// start tuening before it stops...
yaw(-90, 8, 13);

if sec >= 20 then 
  px := Accelerate(10, meters, 20, 30); 

pitch(20, 25, 30);
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

So what do I do first? I've only used the old animation technique before.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

Just copy the whole script and paste it in the script editor for the 302 and run it in daft and simple draft mode ans even al low resolution like 25% so you can see the animation better.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

Video.jpg
Video.jpg (104.3 KiB) Viewed 16575 times
I'm here, the panel beneath available objects where the script has to go, I can't paste, or even type in there? :?:
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

you forgot to create 2scenes. Just click on the Add Scene icon and add 2 of them. Then right click your 302 so it's selected then paste the script and click Play.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

but go into Draft and Simple Draft mode before you play the animation. Get out of Draft before you save it to a video file.
Your support team.
https://SoftByteLabs.com
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

oh, and change the video length to 30 sec.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

Hmmm, its moving....sideways :mrgreen: going to the right, starboard.
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

lol then change all px to py
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

Now that works. How do we determine where to turn? Currently it turned too early and onto the concrete section to the left of the runway. I guess I should have measured the distance to the turn shouldn't I?
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

No, you don't need to calculate distances, only time. Just change all the timing to what works, I had them set just out of my head. Like 10, 20 change it to the start and end that you need.
Your support team.
https://SoftByteLabs.com
User avatar
GateGirl86
Posts: 845
Joined: Mon Oct 03, 2022 8:32 pm

Re: New function in animator

Post by GateGirl86 »

Now I'm in a world not of my own. As there are quite a number of sets. Which ones to do alter?

// here we set 2 variables for the acceleration we need...
Acc1 := Accelerate(1, meters, 1, 3); // set to zero if sec < 1 and full acceleration at sec >= 3
Acc2 := Accelerate(1, meters, 10, 15); // set to zero if sec < 10 and full acceleration at sec >= 15

// if sec is less than the start for acc2, keep using acc1...
if sec < 10 then
py := acc1;

// Slow down to a stop after 10 sec...
if sec > 10 then begin
// subtract new acceleration from current...
py := acc1 - acc2;
// this just make sure it doesn't start to go backward after 15 sec...
if py < 0 then
py := 0;
end;

// start tuening before it stops...
yaw(-90, 8, 13);

if sec >= 20 then
py := Accelerate(10, meters, 20, 30);

pitch(20, 25, 30);
Image
"Come with me if you want to live."
Sarah Connor
User avatar
Support
Site Admin
Posts: 3004
Joined: Sun Oct 02, 2011 10:49 am

Re: New function in animator

Post by Support »

Let me write you something easy...
Your support team.
https://SoftByteLabs.com
Post Reply