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.
- The first parameter is the activator which in this case is a button.
- 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).
- 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.
- 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!