Parade Floats with Blender

Show us what you can do! Let us know how you did it!

Parade Floats with Blender

Postby D'Lanor » Tue Sep 14, 2010 8:14 am

In response to this topic in the MOUL forum I posted this video which shows the results of my attempt at attachables in Blender. I was asked in a PM to show how it is done.

A similar topic in this forum is in the 3ds Max section, but since I did it in Blender I think the best place to post about this is here.

First off, if you want to play with this you can download the age files here.

Those who want to know how it works can get the source files here. This zip file contains the Blender and Python files. Yes, that is right: It is the Python code which makes it work. Now before you run away screaming, I have tried to set this up as a template so you shouldn't have to change the code itself, except where it mentions the age name. I believe these Python files should work for Max users as well if you give them a unique id number.
One more thing about the Python code: It was designed to be multiplayer compatible but that has not been tested. So you can expect a few bugs in multiplayer environments.

Now we move on to the Python file mods, the parameters which the Python file expects to receive from the prp file. In Max these are parsed automatically from the Python file but in Blender you have to set them up with AlcScript. This is only the relevant section. The full AlcScript can be found in the source files.

Code: Select all
          - type: pythonfile
            name: cPythCarryObject
            pythonfile:
                file: testCarryObject
                parameters:
                  - type: activator
                    ref: logicmod:ButtonClick
                  - type: sceneobject
                    ref: scnobj:Cube
                  - type: float
                    value: 3.5
                  - type: string
                    value: ObjOperatorID

testCarryObject is the name of my Python file. For your own age you have to change its external name and its internal class name to something that fits your age.

  1. The first parameter is the activator which in this case is a button.
  2. The second parameter is the object you want to attach. You have to make sure that its center is at floor level because it will line up to the feet of the avatar. Also make sure the object is an actor. You can give this object child objects as I have done to make the button move along with it (see blend file).
  3. The third parameter is the wait time. In this age the button click has an avatar animation so we must wait for the avatar animation to finish before attaching the object. During this wait time keyboard and mouse input are disabled to make sure the user does not cause any misalignment.
  4. Last but not least comes the SDL variable name. The SDL variable keeps track of who is carrying the object in a multiplayer environment. If all goes well only one person at the time should be able to hold the object, but again... this has not been tested yet.

Note: I did not make the attachable a kickable because evil things will happen to the avatar if it falls over.

Edit: Important additional instructions - Make sure to place your attachable object and its child objects (if any) in a separate prp!
Last edited by D'Lanor on Wed Sep 15, 2010 12:36 pm, edited 1 time in total.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Parade Floats with Blender

Postby Lontahv » Tue Sep 14, 2010 7:17 pm

Is it multiplayer compatible? I remember that Attach object isn't.
Currently getting some ink on my hands over at the Guild Of Ink-Makers (PyPRP2).
User avatar
Lontahv
Councilor of Artistic Direction
 
Posts: 1331
Joined: Wed Oct 03, 2007 2:09 pm

Re: Parade Floats with Blender

Postby D'Lanor » Wed Sep 15, 2010 12:20 am

It cannot be netforced so you need to let each client handle this for itself, which IMO is actually better than netforcing.

As for multiplayer compatibility, I have run into another showstopper when testing that. If the player to whom the object is attached links out or quits the entire age disappears for the remaining players. :shock: Collisions and lights are still there but the visuals are gone. A link out can be detected and worked around but quitting cannot. :(

I have yet to investigate if it is the entire age going invisible or if it is just the prp that contains the attached object. In the latter case the attachable could be placed in a separate prp to avoid the "damage" and this may still be usable.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Parade Floats with Blender

Postby diafero » Wed Sep 15, 2010 2:43 am

:lol: what a great bug :D
I prefer e-mails to "diafero arcor de" (after adding the at and the dot) over PMs.

"Many people's horizon is a circle with a radius of zero. They call it their point of view."

Deep Island Shard | Offline KI
diafero
Deep Island Admin
 
Posts: 2966
Joined: Mon May 05, 2008 5:50 am
Location: Germany

Re: Parade Floats with Blender

Postby D'Lanor » Wed Sep 15, 2010 12:51 pm

As I suspected it is only the prp file that contains the attachable which can be removed by a quitting player. So you MUST place the attachable object and its child objects (if any) in a separate prp file in order to prevent the entire age from being removed.

The Python code has been improved as well so that an accidental removal of the attachable no longer happens when the player with the attached object links out. It still happens when that player quits though. In that case the remaining players will just have to relink.

I have updated the instructions and the downloads in the first post accordingly.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am


Return to Tips and Showcase

Who is online

Users browsing this forum: No registered users and 0 guests