Author Topic: tossing a debris or an item via script - how ?  (Read 382 times)

0 Members and 1 Guest are viewing this topic.

motorsep

  • Hero Member
  • *****
  • Posts: 967
  • Karma: +74/-128
  • Artist
    • View Profile
    • Kot in Action Creative Artel
tossing a debris or an item via script - how ?
« on: July 31, 2015, 10:42:16 AM »
Is there any script event that would toss another entity (either debris or movable item)  ?

solarsplace

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +8/-0
  • Mainly a programmer...
    • View Profile
Re: tossing a debris or an item via script - how ?
« Reply #1 on: July 31, 2015, 11:08:50 AM »
Hi

Nothing ready made, but this is the script 'overview' of what I do in the SDK to 'toss' an item.

This should work:

Spawn your moveable item with "nodrop" "1" keyval set.

Set its origin where you want it to be - just in front of player?

Ideally you want to test whether you can spawn a bounding box in front of the player with no collision to make sure you don't spawn into a wall! could be a pain in script! or just do a trace out say 128 units and make sure you don't hit anything before you spawn it.

Then create a vector variable pointing forward of the player.

Then:

// Sets the current linear velocity of this entity in units per second. The linear velocity of
// a physics object is a vector that defines the translation of the center of mass in units per second.
scriptEvent   void    setLinearVelocity( vector velocity );

Have a look in one of the Doom3 AI scripts like 'ai_monster_flying_lostsoul.script' for an example of how to use this.

Sorry not at a comp where I can create a script right now.

Thanks

motorsep

  • Hero Member
  • *****
  • Posts: 967
  • Karma: +74/-128
  • Artist
    • View Profile
    • Kot in Action Creative Artel
Re: tossing a debris or an item via script - how ?
« Reply #2 on: July 31, 2015, 11:18:38 AM »
Aye, thanks for the tip. It makes sense and gives me idea of how to approach it.