How to access vkSky members (HourOfDay, SunsetAngle, ..etc) from a vkEntity3D ?

(9 posts) (2 voices)
  • Started 10 months ago by flipopdefiets
  • Latest reply from hiddentux

Tags:

No tags yet.

  1. flipopdefiets

    member
    Joined: May '13
    Posts: 36

    I am struggling to understand how links works between different actors in a stage.

    here is the context:
    - I have an actor made of two sub actors (3dxml from CATIA) each with one behaviors (azimuth and elevation). These behaviors works fine with the keyboard.
    - now I try to link the azimuth and elevation move with vkSky which is not in the direct component ring of my actor.

    Posted 10 months ago #
  2. flipopdefiets

    member
    Joined: May '13
    Posts: 36

    Here is an picture of my tracker. Thanks for your help

    Posted 10 months ago #
  3. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 378

    Hi Flipopdefiets,

    Basically when you need to link Actors in Studio, you have to use Members.
    So in this case, you should declare a member of type vkSkyPtr in the behaviors of your SubActors, and then you'll be able to use the associated methods (SetSunsetAngle(), SetHourOfDay()...) as if it were in the Component Ring.

    Posted 10 months ago #
  4. flipopdefiets

    member
    Joined: May '13
    Posts: 36

    i have created a new member in the behavior of my SubActor:

    vkSkyPtr CurrentHour;

    but

    float hour= CurrentHour.GetHourOfDay();

    compiles but gives the follwing error:
    [bool HubBe::Rotation::Execute(const vkTaskContext& iCtx)] Call on invalid object : "float vkSky::GetHourOfDay()",

    Posted 10 months ago #
  5. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 378

    OK I forgot two things :

    - When you create a member, the only thing you make is a type declaration (in order to access the associated methods and parameters). You still have to tell on which Actor you want to work. This is done in the Assemble Workset, in the Property View of the behavior containing the member. If you have several Actors with the same type, Studio will present you a list of all of them, and you'll have to choose exactly which one you want to link.

    - As you can't know if this value has been set or not, every time you use a member in your code, you better test that it's different from null. This way, if it's null, your code won't be executed, but at least your Experience won't crash.

    Posted 10 months ago #
  6. flipopdefiets

    member
    Joined: May '13
    Posts: 36

    The behavior with the member (vkSkyPtr) is already linked to the actor (behavior is in its component ring and vkNode3DPtr and BehaviorPtr are declared in the target). Why and where do i have to declare the link a second time:

    in the property view of the behavior I see only : Active, Active at present and Component ID?

    Or do I have to create the behavior in vkSky class? I would appreciate if you could send me an example of link.

    Posted 10 months ago #
  7. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 378

    Yep, but I was talking about the link of the member, not the one of its behavior.

    You'll find attached a small example with a Behavior that drives the hour of the day of a vkSky.

    Attachments

    1. Forum_Link.mpexp (5541.4 KB, 7 downloads) 10 months old
    WARNING: Files uploaded in the forums are not monitored by 3DVIA and therefore might contain content that is malicious or offensive. Download at your own risk
    Posted 10 months ago #
  8. flipopdefiets

    member
    Joined: May '13
    Posts: 36

    thanks hiddentux.

    the reason why I couldn't see vkSkyPtr is that i had declare it in the script, and not in the members list. Now I can see it in the behavior properties. My tracker now follow the sun !

    It is great to see you guys so reactive in this forum, I really appreciate!

    Posted 10 months ago #
  9. hiddentux

    3D Experience Guru
    Joined: Feb '09
    Posts: 378

    Oh, OK. For information, if you ever wanted to retrieve the Sky in the script, you would have to use something like vkStage::GetActor("Name").

    You're welcome

    Posted 10 months ago #

Reply

You must log in to post.