Jump to content

Recommended Posts

In 2010 the scripting genius Becca Moulliez generously released her BWind Sailing Engine, a set of interactive scripts to fully animate a sailing boat.

Even after much Googling I have been unable to find out how to modify these scripts to work in conjunction with the current practice of creating the  components of a boat in mesh, especially the sails and boom.

Perhaps there is someone who has succeeded in bringing these scripts up to date, and in Becca's spirit would be prepared to share the knowledge.

The SL sailing community would be extremely grateful

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Could you be a bit more specific about what the problem is using the BWind Sailing Engine scripts with mesh boats, "especially the sails and boom"?

There's nothing particularly special about mesh from the scripter's point of view, other than that it can have up to 8 faces.    The main headache (and I suspect this is what you may be experiencing) is that the mesh objects' local axes don't necessary face in the direction you expect them to.   That's easily solvable, but on a case-by-case basis.    If that's the problem, it would be a matter of swapping round some values in formulae involving the sails and boom but would that can be done only by someone who has seen the objects that are being used.

But without knowing more about the problem, it's hard to suggest solutions.

Share this post


Link to post
Share on other sites

Thank you so much Innula for taking the time to reply to my problem.

I feel really guilty about showing my ignorance in the presence of someone as experienced as you in matters of scripting.

I have a long-time knowledge of Basic programming, and understand most of the concepts, but am having real difficulty in transferring these skills to LSL. Perhaps put that down to brain deterioration with age!

Despite studying the BWind MAINSAIL script (copy attached) until I can almost recite it by heart, I cannot fathom-out how to introduce statements to control the individual faces of a mesh sail. I appreciate that there can be up to 8 faces and I will need to utilize all of these if I am going to have a double-sided sail with 'billowing' in two directions, and also a sort of 'flapping' phase as it moves from one side of the boat to the other.

I am quite good at working things out if I can see an example of something similar that has already been done, and wonder if you could perhaps point me in the direction of an existing script that shows how this might be achieved.

Your help will be really gratefully appreciated.

5b3c9d3fdac0f_BWindMAINSAILscript.thumb.jpg.727688569e3aaf5c0645eefcba8b9c16.jpg

Share this post


Link to post
Share on other sites

The two lines you need to look at are lines 42

        initRot=llEuler2Rot(<0,0,PI_BY_TWO>); //INITIAL SAIL ROTATION (ON Z AXIS) DEFINED BY USER

and 71

            eulerRot=<0,0,num*DEG_TO_RAD>;

those both specify the script is to rotate the sail about the sail's own vertical axis, which is, in SL's frame of reference, the positive z axis.   If you rez a box on the ground  and select it with the edit tools, you'll see it's the vertical blue line running through the box's centre.

When people make meshes using Blender or Maya, or whatever, and upload them, however, the axes sometimes get switched round for reasons I don't fully understand, and don't correspond with what SL expects, with the result that when you try to move or rotate the objects by script, they don't end up where you expect them to because the server thinks it's dealing with a conventionally-rotated object rather than one with the axes pointing in the wrong directions (wrong, as far as SL is concerned, anyway).

This should be a simple fix (famous last words), at least if the axis about which you want to rotate the sail runs up and down the centre of the object (the main sail in the example boat that comes with the scripts is a path-cut prim, so the prim's centre abuts the mast, on the same principle as a pathcut door.   Simply rez your mesh sail, select it with the editor, and choose the LOCAL frame of reference from the drop-own next to "snap" on the top right (at least in the Official Viewer).    Observe the colour of the mesh's vertical axis.    As far as SL is concerned, the red arrow is the sail's X axis, the green arrow is the sail's Y axis and the blue arrow is the sail's Z axis.

If all is as I hope, and the sail has an arrow running up/down along its centre (i.e. the mesh maker has offset the sail's centre if necessary) then you simply need to swap the positions of PI_BY_TWO (line 42) and num*DEG_TO_RAD (line 71) to match the sail's frame of reference.   

So if the red arrow runs up and down the side of the sail, then you need initRot=llEuler2Rot(<PI_BY_TWO ,0,0>); and eulerRot=<num*DEG_TO_RAD,0,0>;   

If it's the green arrow, then it's initRot=llEuler2Rot(<0,PI_BY_TWO ,0>); and eulerRot=<0,num*DEG_TO_RAD,0>; 

If the arrows don't run up and down where you want the sail to pivot, all is not lost,  but I'd need to see the sail object before saying any more.   And in that case it might be simpler to ask the mesh maker to re-upload the sail (or buy one from someone else who understands axes).   But try my suggestion first.

Share this post


Link to post
Share on other sites

Thank you so much Innula.

I have followed all your instructions about uploading a sail and checking the pivot point etc, and all seems to be in good order.

In fact, I design the sails myself and make provision for the pivot axis, so all is well in that department.

The difficulty arises when I add a second mesh surface to represent the reverse-face of the sail material.

When I incorporate this two-face mesh sail into a BWind boat everything behaves very strangely when sailing. The sail pivots about the mast as required, but swings only to one side of the boat, and the mesh of the reverse-face appears at 180 degrees to the main face (showing a sort of 'X' formation when viewed from directly above).

I haven't tried adding more mesh faces to the mainsail because, without some reference to them in the scripting, I suspect the situation can only become worse.

Does anything obvious spring to mind ?

Edited by Krystle Poikolainen

Share this post


Link to post
Share on other sites

I don't really understand what you're describing.   You've got a sail object with two faces.   I'm assuming that these are on opposite sides of the mesh, so on the sail's positive and negative x axis (or maybe its y axis).

I don't really understand how the two opposite sides of the sail end up "showing a sort of 'X' formation when viewed from directly above" (which I think puts the two faces at 90 degrees to each other, not 180).   The script tells the whole sail to rotate -- LSL  can't move the two faces of a single object separately -- so I don't see how they can come adrift like that.   It's a viewer problem, it seems to me, with your gpu and cpu not drawing the sail as it should be.

Maybe a picture of the sail object would help.  Or if you want to pass me a copy in world I'll take a look at it, since I suspect I'm not understanding something crucial you're trying to tell me.

Share this post


Link to post
Share on other sites

Like Innula, I have a hard time envisioning the sail from your description, but I think it sounds as if the reverse face was somehow created with its Z axis (or whatever is its Up-Down axis) reversed from the main face.  Don't ask me how.  I suspect it's in how you made the mesh.  Since it's your own work, the easy solution is probably to go back to Maya or whatever you used, fiddle with the orientation, and then re-import the corrected model to SL.  That beats doing all the matrix manipulation to get it to play well with your script.

Share this post


Link to post
Share on other sites

Thanks, both of you for your comments. My mistake, of course I meant 90 degrees (or maybe 270) between the two visible mesh faces. But the problem still exists.

I'm still mystified by the procedure for identifying the various mesh faces in the BWind script if my sail object has, say, 8 faces to allow for showing both sides in various conditions of curvature.

If I may, Innula, I'll transfer a test boat to you in world so that you can see my problem.

Thanks for your interest and assistance.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...