Пример #1
0
/*
 *******************************************************************
 * Function: CKERROR CreateGetCIValueProto( CKBehaviorPrototype** behaviorPrototypePtr )
 *
 * Description : The prototype creation function will be called the first time 
 *               a behavior must be created to create the CKBehaviorPrototype 
 *               that contains the description of the behavior.
 *
 * Parameters :
 *    behaviorPrototypePtr    w   Pointer to a CKBehaviorPrototype object that 
 *                                describes the behavior's internal structure 
 *                                and relationships with other objects.
 *
 * Returns : CKERROR
 *
 *******************************************************************
 */
CKERROR CreateGetCIValueProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(GBL_CI_API_ENTRY("GetCI"));
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("Start");
	proto->DeclareOutput("Success");
	
	proto->DeclareInParameter("Configurable Information", CIPARAMETERGUID);
	
	proto->DeclareOutParameter("Configurable Information Value", CKPGUID_STRING);

	proto->DeclareSetting("Get CI by unique name",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Get value as string",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Output custom values",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Output on change",CKPGUID_BOOL,"FALSE");


	proto->SetBehaviorFlags((CK_BEHAVIOR_FLAGS)( CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS ));
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorCallbackFct(GetCIValueCB);
	proto->SetFunction(GetCIValue);

	*pproto = proto;
	return CK_OK;
}
Пример #2
0
CKERROR CreateRetrieveCIProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(GBL_CI_API_ENTRY("RetrieveCI"));
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("Start");
	proto->DeclareOutput("Success");
	proto->DeclareOutput("Error");
	
	proto->DeclareInParameter("Configurable Information ID", CKPGUID_INT);

	proto->DeclareOutParameter("Configurable Information Value", CKPGUID_STRING);

	proto->DeclareOutParameter("GetErrorCode", GUID_TGBLERROR);

	proto->DeclareSetting("Get value as string",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Output custom values",CKPGUID_BOOL,"FALSE");

	proto->SetBehaviorFlags((CK_BEHAVIOR_FLAGS)( CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS ));
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorCallbackFct(RetrieveCICB);
	proto->SetFunction(RetrieveCI);

	*pproto = proto;
	return CK_OK;
}
Пример #3
0
/*
 *******************************************************************
 * Function: CKERROR CreateCISIteratorBBProto( CKBehaviorPrototype** behaviorPrototypePtr )
 *
 * Description : The prototype creation function will be called the first time 
 *               a behavior must be created to create the CKBehaviorPrototype 
 *               that contains the description of the behavior.
 *
 * Parameters :
 *    behaviorPrototypePtr    w   Pointer to a CKBehaviorPrototype object that 
 *                                describes the behavior's internal structure 
 *                                and relationships with other objects.
 *
 * Returns : CKERROR
 *
 *******************************************************************
 */
CKERROR CreateCISIteratorBBProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype(GBL_CI_API_ENTRY("CISIterator"));
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("On/Reset");
	proto->DeclareOutput("Exit On/Reset");

	proto->DeclareInput("Loop In");
	proto->DeclareOutput("Loop Out");

	    
	proto->DeclareOutParameter("value", CKPGUID_STRING,"-1");					
	proto->DeclareOutParameter("default value", CKPGUID_STRING,"-1");					

	proto->DeclareOutParameter("unique name", CKPGUID_STRING,"");
	proto->DeclareOutParameter("description", CKPGUID_STRING,"-1");					
	proto->DeclareOutParameter("access flags", CIPRTFLAGSGUID,"");				
	proto->DeclareOutParameter("parameter type", CKPGUID_PARAMETERTYPE,"-1");	
	proto->DeclareOutParameter("ci db index", CKPGUID_INT,"-1");	

	proto->DeclareLocalParameter(NULL, CKPGUID_INT); // index
	proto->DeclareLocalParameter(NULL, CKPGUID_INT); // cis size
	proto->DeclareLocalParameter(NULL, CKPGUID_POINTER); // ciid list
	proto->DeclareSetting("Read From Database", CKPGUID_BOOL,"FALSE");	
    
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);

	proto->SetBehaviorCallbackFct(CISIteratorCB);
	proto->SetFunction(CISIteratorBB);

	*pproto = proto;
	return CK_OK;
}
Пример #4
0
CKERROR CreateKeyboardCameraOrbitProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("Keyboard Camera Orbit");
	if(!proto) return CKERR_OUTOFMEMORY;

	// General Description
	CKERROR error = FillGeneralCameraOrbitProto(proto);
	if (error != CK_OK)
		return (error);

	// Additionnal Settings for the Keyboard
	proto->DeclareSetting("Key Rotate Left", CKPGUID_KEY,"Left Arrow");
	proto->DeclareSetting("Key Rotate Right", CKPGUID_KEY,"Right Arrow");
	proto->DeclareSetting("Key Rotate Up", CKPGUID_KEY,"Up Arrow");
	proto->DeclareSetting("Key Rotate Down", CKPGUID_KEY,"Down Arrow");
	proto->DeclareSetting("Key Zoom In", CKPGUID_KEY,"PREVIOUS");
	proto->DeclareSetting("Key Zoom Out", CKPGUID_KEY,"NEXT");

	// Set the execution functions
	proto->SetFunction(KeyboardCameraOrbit);
	proto->SetBehaviorCallbackFct(GeneralCameraOrbitCallback,CKCB_BEHAVIORSETTINGSEDITED|CKCB_BEHAVIORLOAD|CKCB_BEHAVIORCREATE);

	// return OK
	*pproto = proto;
	return CK_OK;
}
Пример #5
0
CKERROR CreateDOUserValueModifiedProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("DOUserValueModified");
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("In");
	proto->DeclareInput("Off");
	proto->DeclareInput("Next Value");



	proto->DeclareOutput("Exit In");
	proto->DeclareOutput("Exit Off");
	proto->DeclareOutput("New Value");
	proto->DeclareOutput("Error");


	
	proto->DeclareInParameter("Connection ID", CKPGUID_INT, "0");
	proto->DeclareInParameter("Object", CKPGUID_BEOBJECT, "test");
	
	proto->DeclareOutParameter("Time", CKPGUID_TIME, "0");
	proto->DeclareOutParameter("Value", CKPGUID_STRING, "No Error");
	proto->DeclareOutParameter("Error", VTE_NETWORK_ERROR, "Ok");

	proto->DeclareSetting("Class", CKPGUID_STRING, "My3DClass");
	proto->DeclareSetting("Parameter Name", CKPGUID_STRING, "test");

	
	
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorFlags((CK_BEHAVIOR_FLAGS)( CKBEHAVIOR_VARIABLEPARAMETEROUTPUTS  ));
	proto->SetFunction(DOUserValueModified);
	proto->SetBehaviorCallbackFct(DOUserValueModifiedCB);

	*pproto = proto;
	return CK_OK;

}
Пример #6
0
/*
 *******************************************************************
 * Function: CKERROR CreatePrototype( CKBehaviorPrototype** behaviorPrototypePtr )
 *
 * Description : The prototype creation function will be called the first time 
 *               a behavior must be created to create the CKBehaviorPrototype 
 *               that contains the description of the behavior.
 *
 * Parameters :
 *    behaviorPrototypePtr        Pointer to a CKBehaviorPrototype object that 
 *                                describes the behavior's internal structure 
 *                                and relationships with other objects.
 *
 * Returns : CKERROR
 *
 *******************************************************************
 */
CKERROR GBLCOBGWrapper::CreatePrototype( CKBehaviorPrototype** behaviorPrototypePtr )
	{

#if GBL_RUNTIME	
	// Not editable from Virtools Dev
	CKBehaviorPrototype *behaviorPrototype = CreateCKBehaviorPrototypeRunTime( "GBLCOBGWrapper" );
#elif GBL_GAMEDEVELOPER 
	// Edition depend on the BB.
	CKBehaviorPrototype *behaviorPrototype = CreateCKBehaviorPrototype( "GBLCOBGWrapper" );
#else					
	// Editable from Virtools Dev
	CKBehaviorPrototype *behaviorPrototype = CreateCKBehaviorPrototype( "GBLCOBGWrapper" );
#endif 

	
	if ( !behaviorPrototype ) 
        return CKERR_OUTOFMEMORY;

    //----	Local Parameters Declaration
	behaviorPrototype->DeclareLocalParameter("BG Script", CKPGUID_BEHAVIOR );

    //----	Settings Declaration
	behaviorPrototype->DeclareSetting("BG filename", CKPGUID_STRING ,"path undefined.(BGWrapper Settings)");

	behaviorPrototype->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);

	behaviorPrototype->SetBehaviorFlags((CK_BEHAVIOR_FLAGS)(CKBEHAVIOR_INTERNALLYCREATEDINPUTS |
												CKBEHAVIOR_INTERNALLYCREATEDINPUTPARAMS |
												CKBEHAVIOR_INTERNALLYCREATEDOUTPUTS |
												CKBEHAVIOR_INTERNALLYCREATEDOUTPUTPARAMS));

	behaviorPrototype->SetBehaviorCallbackFct(BGWrapperCB,
												CKCB_BEHAVIORLOAD |
												CKCB_BEHAVIORRESET |
												CKCB_BEHAVIORSETTINGSEDITED |
												CKCB_BEHAVIORDETACH |
												CKCB_BEHAVIORDEACTIVATESCRIPT
												, NULL);

    behaviorPrototype->SetFunction( GBLCOBGWrapper::BehaviourFunction );
    
    *behaviorPrototypePtr = behaviorPrototype;
    return CK_OK;
}
Пример #7
0
/*
*******************************************************************
* Function: 
*
* Description: 
*    
* Parameters: 
*
* Returns: 
*
*******************************************************************
*/
CKERROR CreateNSUnlockObjectProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("NSUnlock");
	if(!proto) return CKERR_OUTOFMEMORY;



	proto->DeclareInput("In");
	
	proto->DeclareOutput("Unlocked");
	proto->DeclareOutput("Waiting For Answer");
	proto->DeclareOutput("Error");

	proto->DeclareInParameter("Connection ID", CKPGUID_INT, "0");
	proto->DeclareOutParameter("Error", VTE_NETWORK_ERROR, "Ok");
	proto->DeclareSetting("Wait For Answer", CKPGUID_BOOL, "0");
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetFunction(NSUnlockObject);
	proto->SetBehaviorCallbackFct(NSUnlockObjectCB);

	*pproto = proto;
	return CK_OK;

}
Пример #8
0
/*
 *******************************************************************
 * Function: CreateBehaviourPrototype() 
 *
 * Description : Declares the BB's inputs and outputs
 *		
 * Parameters :
 *    ppProto, w: Passed in from Virtools
 *
 * Returns : CKERROR - Standard virtools return type
 *
 *******************************************************************
*/
CKERROR CGBLListBox::CreateBehaviourPrototype(CKBehaviorPrototype** ppProto)
{
	CKERROR err = CK_OK;

	// Call base class to create instance of CKBehaviorPrototype and
	// also declare the widget base inputs,  outputs and flags
	CKBehaviorPrototype *pProto = CGBLWidget::CreateBaseBehaviourPrototype("GBLListBox");
	if (!pProto) 
    {
		err = CKERR_OUTOFMEMORY;
	}
	else {
        // Beh inputs:
        if (eBehInputFocus != pProto->DeclareInput("Focus"))
            assert(NULL);
        if (eBehInputSelect != pProto->DeclareInput("Select"))
            assert(NULL);

        // Beh outputs:
        if (eBehOutputNewSelection != pProto->DeclareOutput("New Selection"))
            assert(NULL);

		// Parameter inputs:
		if (eParamInputMaterial != pProto->DeclareInParameter("Material", CKPGUID_MATERIAL))
            assert(NULL);

		if (eParamInputStringListArray != pProto->DeclareInParameter("String List Array", CKPGUID_DATAARRAY))
            assert(NULL);

		if (eParamInputColumnsArray != pProto->DeclareInParameter("Columns Array", CKPGUID_DATAARRAY))
            assert(NULL);

		if (eParamInputFocusItem != pProto->DeclareInParameter("Focus Item", CKPGUID_INT))
            assert(NULL);

		if (eParamInputSelectedItem != pProto->DeclareInParameter("Selected Item", CKPGUID_INT))
            assert(NULL);

        // Param outputs:
        if (eParamOutputSelectedItem != pProto->DeclareOutParameter("Selected Item", CKPGUID_INT))
            assert(NULL);


        // Local params:
        if (eLocalParamFocussedItem != pProto->DeclareLocalParameter("Focussed Item", CKPGUID_INT, "0"))
            assert(NULL);
        if (eLocalParamSelectionType != pProto->DeclareSetting("Selection Type", CKGUID_GBLLISTBOXSELECTIONTYPE, "1"))
            assert(NULL);

        if (eLocalParamIsScrollDownButtonPressed != pProto->DeclareLocalParameter("Scroll Down Button Pressed", CKPGUID_BOOL, "0"))
            assert(NULL);
        if (eLocalParamIsScrollUpButtonPressed != pProto->DeclareLocalParameter("Scroll Up Button Pressed", CKPGUID_BOOL, "0"))
            assert(NULL);

        if (eLocalParamScrollOffset != pProto->DeclareLocalParameter("Scroll Offset", CKPGUID_INT, "0"))
            assert(NULL);
 
        if (eLocalParamScrollMouseDirection != pProto->DeclareLocalParameter("Scroll Mouse Direction", CKPGUID_INT, "0"))
            assert(NULL);
        if (eLocalParamScrollKeyboardDirection != pProto->DeclareLocalParameter("Scroll Keyboard Direction", CKPGUID_INT, "0"))
            assert(NULL);
        if (eLocalParamScrollTimeDelta != pProto->DeclareLocalParameter("Scroll Time Delta", CKPGUID_INT, "0"))
            assert(NULL);

        CKCHAR defaultDelay[256];
        ::sprintf(defaultDelay, "%d", CGBLWidgetsTheme::GetInitialScrollDelay());
        if (eLocalParamScrollDelay != pProto->DeclareLocalParameter("Scroll Delay", CKPGUID_INT, defaultDelay))
            assert(NULL);


        // Set the behaviour function
		pProto->SetFunction(BehaviourFunction);

		// Everything must have gone OK, pass back Proto pointer to Virtools
		*ppProto = pProto;
	}

	return err;
}
Пример #9
0
//************************************
// Method:    CreatePBPhysicalizeProto
// FullName:  CreatePBPhysicalizeProto
// Access:    public 
// Returns:   CKERROR
// Qualifier:
// Parameter: CKBehaviorPrototype **pproto
//************************************
CKERROR CreatePBPhysicalizeProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("PBPhysicalize");
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("In");
	proto->DeclareOutput("Out");

	/* \page TestBlock
	PBPhysicalize  

	PBPhysicalize is categorized in \ref Body

	<h3>Description</h3>
	Apply to a <A HREF="Documentation.chm::/beobjects/1_ck3dentity.html">3DEntity</A><br>
	Applies an impulsive torque defined in the actor local coordinate frame to the actor.<br>
	See <A HREF="pBPhysicalize.cmo">pBPhysicalize.cmo</A> for example.
	<h3>Technical Information</h3>

	\image html PBPhysicalize.png

	<SPAN CLASS="in">In: </SPAN>triggers the process
	<BR>
	<SPAN CLASS="out">Out: </SPAN>is activated when the process is completed.
	<BR>
	<BR>
	
	<SPAN CLASS="pin">Target: </SPAN>The 3D Entity associated to the rigid body.
	<BR>
	
	<SPAN CLASS="pin">Flags: </SPAN>Flags to determine common properties for the desired body. See #BodyFlags.
	<BR>
	<SPAN CLASS="pin">Hulltype: </SPAN>The desired shape type. See #HullType.
	<br>
		<SPAN CLASS="framedOrange">You can add or remove sub shapes on the fly by pRigidBody::addSubShape() or #PBAddShape.<br>
			The intial shape can NOT changed after the bodies registration.</SPAN>
		<BR>
	<SPAN CLASS="pin">Density: </SPAN>Density of the initial shape. This will be only used if <br> 
		"Hierarchy" =false and <br> 
		"New Density" !=0.0f or  "Total Mass" != 0.0f. #pRigidBody::updateMassFromShapes() can update the mass dynamically.
	<br>
	<br>
	<SPAN CLASS="pin">Skin Width: </SPAN>Specifies by how much shapes can interpenetrate. See #pRigidBody::setSkinWidth().
	<br>
	<br>
	<SPAN CLASS="pin">Mass Offset: </SPAN>Moves the mass center in the local bodies space.
	<br>
	<br>
	<SPAN CLASS="pin">Pivot Offset: </SPAN>Position of the initial shape in the bodies space.
	<br>
	<br>
	<SPAN CLASS="pin">Target World: </SPAN>Multiple worlds are provided. If not specified, it belongs to an automatically created default world(pDefaultWorld).This parameter must be enabled through the settings of this building block.
	<br>
	<br>
	<SPAN CLASS="pin">Hierarchy: </SPAN>If enabled, this function will parse the entities hierarchy and attaches children as additional collisions shapes. Those children must have the physic attribute attached whereby the sub shape flag must be 
			enabled(#BodyFlags). Sub shapes can be attached by #addSubShape() or #PBAddShape afterwards.
	<br>
	<br>
	<SPAN CLASS="pin">New Density: </SPAN>Density scale factor of the shapes belonging to the body.If you supply a non-zero total mass, 
	the bodies mass and inertia will first be computed as	above and then scaled to fit this total mass. See #pRigidBody::updateMassFromShapes().
	<br>
	<br>
	<SPAN CLASS="pin">Total Mass: </SPAN>Total mass if it has sub shapes.If you supply a non-zero density, 
	the bodies mass and inertia will first be computed as above and then scaled by this factor.See #pRigidBody::updateMassFromShapes().
	<br>
	<br>
	<SPAN CLASS="pin">Material: </SPAN>The material of this body. This parameter must be enabled through the settings of this building block.By default it is using the worlds material. The material of a body can be specified explicity by attaching
	a physic material attribute on the entity or its mesh or the meshs material. This is the lookup order : <br>
	- building block input parameter  <br>
	- entity mesh <br>
	- entities mesh material 
	<br>
	<br>
	<br>
	<SPAN CLASS="setting">Use Default World: </SPAN>Enables input for the world reference.
	<BR>
	<SPAN CLASS="setting">Use Worlds Material: </SPAN>Enables input for a physic material.
	<BR>
	<SPAN CLASS="setting">Add Attributes: </SPAN>Attaches the physic attribute to the entity.
	<BR>
	

	<BR>
	<h3>Warning</h3>

	<h3>Note</h3><br>
	<br>
	<br>
		Is utilizing #pRigidBody #pWorld #PhysicManager #pFactory::createBody().<br>
	
	<h3>VSL</h3><br>
		<SPAN CLASS="NiceCode">
		\include PBPhysicalize.cpp
		</SPAN>

	*/

	
	proto->DeclareInParameter("Flags",VTF_BODY_FLAGS,"Moving Object,Updates in Virtools,Auto Disable,World Gravity,Enabled,Collision");
	proto->DeclareInParameter("Hull type",VTE_COLLIDER_TYPE,"Sphere");
	proto->DeclareInParameter("Density",CKPGUID_FLOAT,"1.0f");
	proto->DeclareInParameter("Skin Width",CKPGUID_FLOAT,"-1.0f");
	
	proto->DeclareInParameter("Mass Offset",CKPGUID_VECTOR,"0.0f,0.0f,0.0f");
	proto->DeclareInParameter("Pivot Offset",CKPGUID_VECTOR,"0.0f,0.0f,0.0f");
	proto->DeclareInParameter("Target World Reference",CKPGUID_3DENTITY,"pDefaultWorld");
	proto->DeclareInParameter("Hierarchy",CKPGUID_BOOL,"FALSE");
	proto->DeclareInParameter("New Density",CKPGUID_FLOAT,"0.0f");
	proto->DeclareInParameter("Total Mass",CKPGUID_FLOAT,"0.0f");
	proto->DeclareInParameter("Material",VTS_MATERIAL);
		
	proto->DeclareSetting("Use Default World",CKPGUID_BOOL,"TRUE");
	proto->DeclareSetting("Use Worlds Material",CKPGUID_BOOL,"TRUE");
	proto->DeclareSetting("Add Attributes",CKPGUID_BOOL,"TRUE");

	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);
	proto->SetBehaviorCallbackFct( PBPhysicalizeCB );
	proto->SetFunction(PBPhysicalize);
	*pproto = proto;
	return CK_OK;
}
Пример #10
0
//************************************
// Method:    CreatePJRevoluteProto
// FullName:  CreatePJRevoluteProto
// Access:    public
// Returns:   CKERROR
// Qualifier:
// Parameter: CKBehaviorPrototype **pproto
//************************************
CKERROR CreatePJRevoluteProto(CKBehaviorPrototype **pproto)
{
    CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("PJRevolute");
    if(!proto) return CKERR_OUTOFMEMORY;

    /*! \page PJRevolute

    <br>
    PJRevolute is categorized in \ref Joints
    <br>
    <br>See <A HREF="PJRevolute.cmo">PJRevolute.cmo</A>.

    <h3>Description</h3>
    Apply to a <A HREF="Documentation.chm::/beobjects/1_ck3dentity.html">3DEntity</A><br>
    Creates or modifies a revolute joint.
    <br>
    <br>
    DOFs removed: 5<br>
    DOFs remaining: 1<br>
    <br>
    \image html revoluteJoint.png

    A revolute joint removes all but a single rotational degree of freedom from two objects.
    The axis along which the two bodies may rotate is specified with a point and a direction
    vector. In theory, the point along the direction vector does not matter, but in practice,
    it should be near the area where the bodies are closest to improve simulation stability.

    An example for a revolute joint is a door hinge.
    Another example would be using a revolute joint to attach rotating fan blades to a
    ceiling. 	The revolute joint could be motorized, causing the fan to rotate.

    <h3>Technical Information</h3>

    \image html PJRevolute.png

    <SPAN CLASS="in">In: </SPAN>triggers the process
    <BR>
    <SPAN CLASS="out">Out: </SPAN>is activated when the process is completed.
    <BR>
    <BR>
    <SPAN CLASS="pin">Body B: </SPAN>The second body. Leave blank to create a joint constraint with the world.
    <BR>
    <BR>

    <SPAN CLASS="pin">Anchor:</SPAN>A point in world space coordinates. See pJointRevolute::setGlobalAnchor().
    <BR>
    <SPAN CLASS="pin">Anchor Reference: </SPAN>A helper entity to transform a local anchor into the world space.
    <BR>

    <SPAN CLASS="pin">Axis: </SPAN>An in world space. See pJointRevolute::setGlobalAxis().
    <BR>
    <SPAN CLASS="pin">Axis Up Reference: </SPAN>A helper entity to transform a local axis into the world space.
    <BR>
    <BR>
    <hr>

    <SPAN CLASS="pin">Collision: </SPAN>Enable Collision. See pJointRevolute::enableCollision().
    <BR>

    <hr>
    <SPAN CLASS="pin">Projection Mode: </SPAN>Joint projection mode. See pJointRevolute::setProjectionMode() and #ProjectionMode.
    <BR>

    <SPAN CLASS="pin">Projection Distance: </SPAN>If any joint projection is used, it is also necessary to set
    projectionDistance to a small value greater than zero. When the joint error is larger than projectionDistance the SDK will change it so that the joint error is equal to projectionDistance. Setting  projectionDistance too
    small will introduce unwanted oscillations into the simulation.See pJointRevolute::setProjectionDistance().
    <br>

    <SPAN CLASS="pin">Projection Angle: </SPAN>Angle must be greater than 0.02f .If its smaller then current algo gets too close to a singularity. See pJointRevolute::setProjectionAngle().
    <BR>


    <hr>
    <SPAN CLASS="pin">Spring: </SPAN>Make it springy.See pJointRevolute::setSpring().
    <BR>

    <hr>
    <SPAN CLASS="pin">High Limit: </SPAN>Higher rotation limit around the rotation axis. See pJointRevolute::setHighLimit().
    <BR>

    <SPAN CLASS="pin">Low Limit: </SPAN>Lower rotation limit around rotation axis. See pJointRevolute::setLowLimit().
    <BR>

    <hr>
    <SPAN CLASS="pin">Motor: </SPAN>Motor parameters. See pJointRevolute::setMotor().
    <BR>
    <BR>

    <hr>

    <SPAN CLASS="setting">Spring: </SPAN>Enables parameter input for spring settings.
    <BR>

    <SPAN CLASS="setting">High Limit: </SPAN>Enables parameter inputs for angular limits.
    <BR>


    <SPAN CLASS="setting">Motor: </SPAN>Enables parameter input for motor settings.
    <BR>



    <h4>Revolute Joint Limits</h4>

    A revolute joint allows limits to be placed on how far it rotates around the joint axis. For example, a hinge on a door cannot rotate through 360 degrees; rather, it can rotate between 20 degrees and 180 degrees.
    The angle of rotation is measured using the joints normal (axis orthogonal to the joints axis). This is the angle reported by NxRevoluteJoint::getAngle(). The limits are specified as a high and low limit, which must satisfy the condition -Pi < low < high <Pi degrees.
    Below are valid revolute joint limits in which the joint is able to move between low and high:

    \image html revoluteJointLimits.png
    <br>

    Note : The white region represents the allowable rotation for the joint.

    <h4>Limitations of Revolute Joint Limits</h4>
    As shown below, it is not possible to specify certain limit configurations without rotating the joint axes, due to the restrictions on the values of low and high:
    \image html revoluteLimitLimitation.png

    To achieve this configuration, it is necessary to rotate the joint counter-clockwise so that low is below the 180 degree line.

    NOTE: If the angular region that is prohibited by the twist limit (as in the above figures) is very small, only a few degrees or so, then the joint may "push through" the limit and out on the other side if the relative angular velocity is large enough in relation to the time step. Care must be taken to make sure the limit is "thick" enough for the typical angular velocities it will be subjected to.


    <BR>
    <h3>Warning</h3>
    The body must be dynamic.
    <br>
    <br>

    <h3>VSL : Creation </h3><br>
    <SPAN CLASS="NiceCode">
    \include PJRevolute.vsl
    </SPAN>
    <br>

    <h3>VSL : Limit Modification  </h3><br>
    <SPAN CLASS="NiceCode">
    \include PJRevoluteSetLimits.vsl
    </SPAN>
    <br>

    <h3>VSL : Motor Modification  </h3><br>
    <SPAN CLASS="NiceCode">
    \include PJRevoluteSetMotor.vsl
    </SPAN>
    <br>
    <br>
    <br>

    Is utilizing #pRigidBody #pWorld #PhysicManager #pFactory::createJointRevolute().<br>

    */
    proto->DeclareInput("In");
    proto->DeclareOutput("Out");
    proto->SetBehaviorCallbackFct( PJRevoluteCB );
    proto->DeclareInParameter("Body B",CKPGUID_3DENTITY,"ball2");

    proto->DeclareInParameter("Anchor",CKPGUID_VECTOR,"0.0f");
    proto->DeclareInParameter("Anchor Reference",CKPGUID_3DENTITY,"0.0f");

    proto->DeclareInParameter("Axis",CKPGUID_VECTOR,"0.0f");
    proto->DeclareInParameter("Axis Up Reference",CKPGUID_3DENTITY);
    proto->DeclareInParameter("Collision",CKPGUID_BOOL);
    proto->DeclareInParameter("Projection Mode",VTE_JOINT_PROJECTION_MODE,"0");
    proto->DeclareInParameter("Projection Distance",CKPGUID_FLOAT,"0");
    proto->DeclareInParameter("Projection Angle",CKPGUID_FLOAT,"0.025");

    proto->DeclareInParameter("Spring",VTS_JOINT_SPRING);
    proto->DeclareInParameter("High Limit",VTS_JLIMIT);
    proto->DeclareInParameter("Low Limit",VTS_JLIMIT);
    proto->DeclareInParameter("Motor",VTS_JOINT_MOTOR);


    proto->DeclareSetting("Spring",CKPGUID_BOOL,"FALSE");
    proto->DeclareSetting("Limit",CKPGUID_BOOL,"FALSE");
    proto->DeclareSetting("Motor",CKPGUID_BOOL,"FALSE");

    proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
    proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);

    proto->SetFunction(PJRevolute);
    *pproto = proto;
    return CK_OK;
}
Пример #11
0
CKERROR CreatePWOverlapSphereProto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("PWOverlapSphere");
	if(!proto) return CKERR_OUTOFMEMORY;

	/*! \page PWOverlapSphere 


	PWOverlapSphere is categorized in \ref Collision

	<h3>Description</h3>
	Apply to a <A HREF="Documentation.chm::/beobjects/1_ck3dentity.html">3DEntity</A><br>
	Performs an overlap test against masked shape groups.Outputs an object only.<br>
	See <A HREF="PWOverlaps.cmo">PWOverlaps.cmo</A> for example.

	<h3>Technical Information</h3>

	\image html PWOverlapSphere.png

	<SPAN CLASS="in">In: </SPAN>triggers the process
	<BR>
	<SPAN CLASS="in">Next: </SPAN>Next Hit.
	<BR>
	
	<SPAN CLASS="in">Next: </SPAN>Iterate through next hit.
	<BR>
	<SPAN CLASS="out">Yes: </SPAN>Hit occured.
	<BR>
	<SPAN CLASS="out">No: </SPAN>No hits.
	<BR>
	<SPAN CLASS="out">Finish: </SPAN>Last hit.
	<BR>
	<SPAN CLASS="out">Next: </SPAN>Loop out.
	<BR>

	<SPAN CLASS="pin">Target: </SPAN>World Reference. pDefaultWorld!
	<BR>
	<SPAN CLASS="pin">Radius: </SPAN>The sphere radius.
	<BR>
	<SPAN CLASS="pin">Center: </SPAN>The spheres center in world space.If shape reference is given, then its transforming this value in its local space.
	<BR>
	<SPAN CLASS="pin">Shapes Types: </SPAN>Adds static and/or dynamic shapes to the test.
	<BR>
	<SPAN CLASS="pin">Accurate: </SPAN>True to test the sphere against the actual shapes, false to test against the AABBs only.
	<BR>
	<SPAN CLASS="pin">Groups: </SPAN>Includes specific groups to the test. 
	<BR>
	<SPAN CLASS="pin">Groups Mask: </SPAN>Alternative mask used to filter shapes. See #pRigidBody::setGroupsMask
	<BR>


	<br>
	<h3>Note</h3><br>
	
	
	<br>
	<br>

	Is utilizing #pWorld::overlapSphereShapes()<br>
	
	*/
	
	proto->DeclareInput("In");
	proto->DeclareInput("Next");



	
	proto->DeclareOutput("Yes");
	proto->DeclareOutput("No");
	proto->DeclareOutput("Finish");
	proto->DeclareOutput("Next");

	proto->DeclareInParameter("Radius",CKPGUID_FLOAT);
	proto->DeclareInParameter("Center",CKPGUID_VECTOR);
	proto->DeclareInParameter("Shape Reference",CKPGUID_3DENTITY);
	proto->DeclareInParameter("Shapes Type",VTF_SHAPES_TYPE);
	proto->DeclareInParameter("Accurate",CKPGUID_BOOL);
	proto->DeclareInParameter("Groups",CKPGUID_INT);
	proto->DeclareInParameter("Filter Mask",VTS_FILTER_GROUPS);




	proto->DeclareLocalParameter("result", CKPGUID_GROUP);
	proto->DeclareLocalParameter("index", CKPGUID_INT);
	proto->DeclareLocalParameter("size", CKPGUID_INT);

	proto->DeclareSetting("Groups",CKPGUID_BOOL,"false");
	proto->DeclareSetting("Groups Mask",CKPGUID_BOOL,"false");


	proto->DeclareOutParameter("Touched Body",CKPGUID_3DENTITY);

	
	//proto->DeclareSetting("Trigger on Enter",CKPGUID_BOOL,"FALSE");
	
	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);
	
	proto->SetBehaviorCallbackFct( PWOverlapSphereCB );
	proto->SetFunction(PWOverlapSphere);
	*pproto = proto;
	return CK_OK;
}
Пример #12
0
//************************************
// Method:    CreatePBGet2Proto
// FullName:  CreatePBGet2Proto
// Access:    public 
// Returns:   CKERROR
// Qualifier:
// Parameter: CKBehaviorPrototype **pproto
//************************************
CKERROR CreatePBGet2Proto(CKBehaviorPrototype **pproto)
{
	CKBehaviorPrototype *proto = CreateCKBehaviorPrototype("PBGetEx-Obsolete");
	if(!proto) return CKERR_OUTOFMEMORY;

	proto->DeclareInput("In");
	proto->DeclareOutput("Out");


	/*
	PBGetEx  

	PBGet2 is categorized in \ref Body

	<h3>Description</h3>
	Apply to a <A HREF="Documentation.chm::/beobjects/1_ck3dentity.html">3DEntity</A><br>
	Retrieves various physical informations.<br>

	<h3>Technical Information</h3>

	\image html PBGet2.png

	<SPAN CLASS="in">In: </SPAN>triggers the process
	<BR>
	<SPAN CLASS="out">Out: </SPAN>is activated when the process is completed.
	<BR>
	<BR>
	<SPAN CLASS="pin">Target: </SPAN>The 3D Entity associated to the rigid body.
	<BR>
	<BR>
	<SPAN CLASS="pout">Collisions Group: </SPAN>Which collision group this body is part of.See pRigidBody::getCollisionsGroup().
	<BR>
	<SPAN CLASS="pout">Kinematic Object: </SPAN>The kinematic state. See pRigidBody::isKinematic().
	<BR>
	<SPAN CLASS="pout">Gravity: </SPAN>The gravity state.See pRigidBody::isAffectedByGravity().
	<BR>
	<SPAN CLASS="pout">Collision: </SPAN>Determines whether the body reacts to collisions.See pRigidBody::isCollisionEnabled(). 
	<BR>
	<BR>
	<SPAN CLASS="setting">Collisions Group: </SPAN>Enables output for collisions group.
	<BR>
	<SPAN CLASS="setting">Kinematic Object: </SPAN>Enables output for kinematic object.
	<BR>
	<SPAN CLASS="setting">Gravity: </SPAN>Enables output for gravity.
	<BR>
	<SPAN CLASS="setting">Collision: </SPAN>Enables output for collision. 
	<BR>
	<BR>
	<BR>

	<BR>
	<h3>Warning</h3>
	The body must be dynamic.
	<br>
	<br>
	<h3>Note</h3>
	Is utilizing #pRigidBody #pWorld #PhysicManager.<br>

	<h3>VSL</h3><br>
	<SPAN CLASS="NiceCode">
		\include PBGetEx.cpp
	</SPAN>
	*/
	

	
	proto->DeclareSetting("Collisions Group",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Kinematic",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Gravity",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Collision",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Mass Offset",CKPGUID_BOOL,"FALSE");
	proto->DeclareSetting("Pivot Offset",CKPGUID_BOOL,"FALSE");

	proto->SetBehaviorCallbackFct( PBGet2CB );
	
	proto->DeclareOutParameter("Collisions Group",CKPGUID_INT,"0");
	proto->DeclareOutParameter("Kinematic Object",CKPGUID_BOOL,"FALSE");
	proto->DeclareOutParameter("Gravity",CKPGUID_BOOL,"FALSE");
	proto->DeclareOutParameter("Collision",CKPGUID_BOOL,"FALSE");
	proto->DeclareOutParameter("Mass Offset",CKPGUID_VECTOR,"0.0f");
	proto->DeclareOutParameter("Pivot Offset",CKPGUID_VECTOR,"0.0f");

	proto->SetFlags(CK_BEHAVIORPROTOTYPE_NORMAL);
	proto->SetBehaviorFlags(CKBEHAVIOR_TARGETABLE);
	
	proto->SetFunction(PBGet2);
	*pproto = proto;
	return CK_OK;
}