| 2181 | } |
| 2182 | |
| 2183 | int CScriptObjectEntity::AddImpulse(IFunctionHandler *pH) |
| 2184 | { |
| 2185 | assert(pH->GetParamCount()==4 || pH->GetParamCount()==5); |
| 2186 | |
| 2187 | |
| 2188 | // float hitImpulse = m_pGame->p_HitImpulse->GetFVal(); |
| 2189 | // if(hitImpulse == 0) |
| 2190 | // return pH->EndFunctionNull(); |
| 2191 | |
| 2192 | int ipart; |
| 2193 | bool bPos; |
| 2194 | Vec3 pos,dir; |
| 2195 | float impulse,impulseScale=1.0f; |
| 2196 | |
| 2197 | pH->GetParam(1, ipart); |
| 2198 | |
| 2199 | CScriptObjectVector oVec(m_pScriptSystem,true); |
| 2200 | if(pH->GetParam(2,*oVec)) |
| 2201 | { |
| 2202 | pos=oVec.Get(); |
| 2203 | bPos=true; |
| 2204 | } |
| 2205 | else |
| 2206 | { |
| 2207 | bPos=false; |
| 2208 | } |
| 2209 | pH->GetParam(3,*oVec); dir=oVec.Get(); |
| 2210 | pH->GetParam(4, impulse); |
| 2211 | pH->GetParam(5, impulseScale); |
| 2212 | bPos = bPos && GetLengthSquared(pos)>0; |
| 2213 | |
| 2214 | if (GetLengthSquared(dir)>0) |
| 2215 | { |
| 2216 | m_pEntity->AddImpulse(ipart,pos,GetNormalized(dir)*impulse,bPos,impulseScale ); |
| 2217 | // m_pEntity->AddImpulse(ipart,pos,dir.Normalized()*impulse*hitImpulse,bPos ); |
| 2218 | } |
| 2219 | |
| 2220 | return pH->EndFunctionNull(); |
| 2221 | } |
| 2222 | |
| 2223 | int CScriptObjectEntity::AddImpulseObj(IFunctionHandler *pH) |
| 2224 | { |
no test coverage detected