Page Loading... please wait!


This message not going away?
Ensure Javascript is on and click the box
May 28, 2017 - 05:59 AM  
Realsoft.org  
 
 

Animating Electrical charge ?

(463 total words in this text)
(7027 Reads)  Printer-friendly page
Tips and Tricks

Animating Electrical charge ?

by Frank "The Rookie" Dodd

Problem:Is it possible to animate all of the physics properties in R3d v4.5 (specifically Electric Charge).

Solution by Frank Dodd for Realsoft V4.5

You can animate it using RPL:

The easiest way to do this is to create a level and set it to simulation. Place the object who's Electrical Charge you want to manipulate into this level (in this example called MyObject) then create a simple analytical sphere in the level (in this example called ControlKnob) then on the script tab of the level set the script to RPL and add the following line:

"ControlKnob.Center.x" Get "MyObject.Charge" Set

Now as you move your control knob sphere left and right the x co-ordinate of the sphere will set the electrical charge of the object you can animated the knob there by animating the Electrical Charge.

If you can get building blocks running under wine or something there are lots of parameters that you can tweak in there and its fairly easy to use (much easier than RPL). Try the following:

  1. Create an analytical sphere at 0, 0, 0 (or close to it)
  2. Paste the following into the scripting tab of the sphers:

    // Includes
    ------------------------------------------------------
    // Variable declarations
    -----------------------------------------------------
    object_translation = new r3Vect(0,0,0);
    my_colour = new r3Vect(0,0,0);
    my_object = new Object;
    // Function definitions
    ------------------------------------------------------
    // JavaScript program
    --------------------------------------------------------
    {
    // Get a Realsoft 3D object from the current object
    bb_currentobjName = Get("Name");
    bb_parentobject = Get("Parent");
    bb_jsparentobject = R3ToJS( bb_parentobject );

    bb_loopctrl = 0;
    while ( my_object = bb_jsparentobject.GETSUBBYORDNUM( bb_loopctrl++ ))
    {
    if ( my_object.GetName() == bb_currentobjName )
    break;
    }
    bb_loopctrl--;

    // Get translation of an object
    object_translation = my_object.GetMatrixTranslate();

    my_colour.x = object_translation.x ;

    // Set the color of an object
    R3Set(my_object.r3obj, R3PRIMA_Color, my_colour, R3TID_VECTOR, 0);

    }

  3. Move the cursor to the end to the script and press return :)
  4. Change the selection in the command language drop down list box to Javascript
  5. Slide the object to the right and you should see it turn red.

Login





 


 Log in Problems?
 New User? Sign Up!

Realsoft Graphics
Copyright © 1989 ... 2012
Realsoft Graphics