/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PHYSICS_H #define CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PHYSICS_H #pragma once #if ENABLE_CRY_PHYSICS #include struct ISystem; struct I3DEngine; struct IPhysicalWorld; /*! * This class implements script-functions for Physics and decals. * After initialization of the script-object it will be globally accessible through scripts using the namespace "Physics". * Physics.CreateDecal(pos, normal, scale, lifetime, decal.texture, decal.object, rotation) * These function will never be called from C-Code. They're script-exclusive. */ class CScriptBind_Physics : public CScriptableBase { public: CScriptBind_Physics(IScriptSystem* pScriptSystem, ISystem* pSystem); virtual ~CScriptBind_Physics(); virtual void GetMemoryUsage(ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } //! Physics.SimulateExplosion( explosionParams ) //! //! Simulate physical explosion. //! Does not apply any game related explosion damages, this function only apply physical forces. //! The parameters are passed as a table containing the elements described below. //! //! Explosion epicenter position. //! Explosion radius. //! Explosion impulse direction. //! Explosion impulse position (Can be different from explosion epicenter). //! Explosion impulse presur at radius distance from epicenter. //! Explosion minimal radius, at this radius full pressure is applied. //! Explosion maximal radius, at this radius impulse pressure will be reaching zero. //! Size of the explosion hole to create in breakable objects. int SimulateExplosion(IFunctionHandler* pH, SmartScriptTable explosionParams); //! Physics.RegisterExplosionShape( sGeometryFile, fSize, nMaterialId, fProbability, sSplintersFile, fSplintersOffset, sSplintersCloudEffect ) //! //! Register a new explosion shape from the static geometry. //! Does not apply any game related explosion damages, this function only apply physical forces. //! //! Static geometry file name (CGF). //! Scale for the static geometry. //! ID of the breakable material to apply this shape on. //! Preference ratio of using this shape then other registered shape. //! additional non-physicalized splinters cgf to place on cut surfaces. //! the lower splinters piece wrt to the upper one. //! particle effect when the splinters constraint breaks. int RegisterExplosionShape(IFunctionHandler* pH, const char* sGeometryFile, float fSize, int nIdMaterial, float fProbability, const char* sSplintersFile, float fSplintersOffset, const char* sSplintersCloudEffect); //! Physics.RegisterExplosionCrack( sGeometryFile, int nMaterialId ) //! Register a new crack for breakable object. //! Static geometry file name fro the crack (CGF). //! ID of the breakable material to apply this crack on. int RegisterExplosionCrack(IFunctionHandler* pH, const char* sGeometryFile, int nIdMaterial); //bool ReadPhysicsTable(IScriptTable *pITable, PhysicsParams &sParamOut) {}; //! Physics.RayWorldIntersection( vPos, vDir, nMaxHits, iEntTypes [, skipEntityId1 [, skipEntityId2]] ) //! Check if ray segment from src to dst intersect anything. //! Ray origin point. //! Ray direction. //! Max number of hits to return, sorted in nearest to farest order. //! Physical Entity types bitmask, ray will only intersect with entities specified by this mask (ent_all,...). //! (optional) Entity id to skip when checking for intersection. //! (optional) Entity id to skip when checking for intersection. int RayWorldIntersection(IFunctionHandler* pH); //! Physics.RayTraceCheck( src, dst, skipEntityId1, skipEntityId2 ) //! Check if ray segment from src to dst intersect anything. //! Ray segment origin point. //! Ray segment end point. //! Entity id to skip when checking for intersection. //! Entity id to skip when checking for intersection. int RayTraceCheck(IFunctionHandler* pH, Vec3 src, Vec3 dst, ScriptHandle skipEntityId1, ScriptHandle skipEntityId2); //! Physics.SamplePhysEnvironment( pt, r [, objtypes] ) //! Find physical entities touched by a sphere. //! center of sphere. //! radius of sphere. //! (optional) physics entity types. int SamplePhysEnvironment(IFunctionHandler* pH); private: ISystem* m_pSystem; I3DEngine* m_p3DEngine; IPhysicalWorld* m_pPhysicalWorld; }; #endif // ENABLE_CRY_PHYSICS #endif // CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PHYSICS_H