Inside3D!
     

Moving a box?

 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
Mexicouger



Joined: 01 May 2010
Posts: 129

PostPosted: Sat May 01, 2010 10:29 pm    Post subject: Moving a box? Reply with quote

I want to create a box that Can just easily be pushed around. I created the entity and all, and its .touch function is this:


void() kick_touch;

void() kick_touch =
{
local vector v;


//trajectory
v_x = (other.velocity_x*2+50*random());
v_y = (other.velocity_y*2+50*random());
v_z = 2 + 50 * random()+(other.velocity_y+other.velocity_x);

self.flags = self.flags - ( self.flags & FL_ONGROUND );
self.velocity = v;

self.flags = self.flags - ( self.flags & FL_ONGROUND );
self.velocity = v;
};

And yes it is the kick gib tutorial. I tried editing the velocity, But it was no use. Without v_z, the bx doesn't even move. So is there anyway I can change this code to make the box slide at the same rate as the player? Thanks In advance. I really need help with this.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Sajt



Joined: 16 Oct 2004
Posts: 1026

PostPosted: Sun May 02, 2010 3:07 am    Post subject: Reply with quote

An object that is MOVETYPE_TOSS only follows velocity while airborne. What I THINK you can do is give it a think function which removes the FL_ONGROUND flag every frame.

void() kick_think =
{
self.nextthink = time;
self.flags = self.flags - (self.flags & FL_ONGROUND);
};

You will have to code your own friction then, though. Or, if you are using DarkPlaces engine, you could just use MOVETYPE_WALK on the box.
_________________
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Back to top
View user's profile Send private message
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Sun May 02, 2010 4:31 pm    Post subject: Reply with quote

Sajt wrote:
An object that is MOVETYPE_TOSS only follows velocity while airborne. What I THINK you can do is give it a think function which removes the FL_ONGROUND flag every frame.

void() kick_think =
{
self.nextthink = time;
self.flags = self.flags - (self.flags & FL_ONGROUND);
};

You will have to code your own friction then, though. Or, if you are using DarkPlaces engine, you could just use MOVETYPE_WALK on the box.


A while ago, I wanted to do the same thing, like pushing boxes around the map. I abandoned the idea, though, as real life took over.

I'd be interested in a simple solution for pushable stuff which implies a bit of physics. Like pushing a box from the edge of a brush and watching it fall upon crossing 50 percent of the edge.

Found some examples on the Quake XNA page:

http://www.benryves.com/gallery/quake/2007/09/13
http://code.google.com/p/quakexna/





EDIT: What about bullet cases falling on the ground? They have some sort of simulated physics.

I really need to look into the code. With my .md3 model inclusion, I'd be able to simulate a pushable object. Right now I have lots of things in my head like BOUNCE, WALK, TOSS, and how to combine them.

Later!
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
ajay



Joined: 29 Oct 2004
Posts: 295
Location: Swindon, UK

PostPosted: Sun May 02, 2010 8:49 pm    Post subject: Reply with quote

Does Gyro allow you to do this? (I've not really played it much so have no idea)
_________________
my site
Back to top
View user's profile Send private message MSN Messenger
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Sun May 02, 2010 8:55 pm    Post subject: Reply with quote

ajay wrote:
Does Gyro allow you to do this? (I've not really played it much so have no idea)


Gyro could do this with a bit of modification. Urre's stick physics could also do this, even better than Gyro, also with some modification.
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Sun May 02, 2010 11:43 pm    Post subject: Reply with quote

No modification required when using Twig. Gyro can do it just fine also.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Chip



Joined: 21 Jan 2009
Posts: 314
Location: Romania

PostPosted: Sun May 02, 2010 11:50 pm    Post subject: Reply with quote

Urre wrote:
No modification required when using Twig. Gyro can do it just fine also.


Well, I mostly meant "integration" when I wrote "modification". It still needs to be hooked up to certain models or functions, right?

Like, I have an .md3 Jeep model. I have a small .md3 general function that renders everything I input using a level editor (QuArK in my case). How hard would be to add a function like AddPhysics()* to that .md3 render function?

*Made-up function
_________________
My Projects: Quake 1 Mods | OpenQuartz 2 | ChipQuake
Back to top
View user's profile Send private message Visit poster's website
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Mon May 03, 2010 4:42 am    Post subject: Reply with quote

I'm slightly confused, sounds almost like engine-side stuff to me, what you're talking about.

Twig wants you to include the files with names starting with phys_* to your codebase. The file called editor_client.qc contains examples of how to use the physics code. You need to create physics info files for each type of object you want to use in your game, and load them using Phys_ObjectCreate();

Note that worldspawn loads all objects into the game first.

In short, inspect editor_client.qc, if you know your QuakeC, it shouldn't be too hard to figure stuff out.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group