Moving a box?
Moderator: InsideQC Admins
8 posts
• Page 1 of 1
Moving a box?
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.
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.
-

Mexicouger - Posts: 514
- Joined: Sat May 01, 2010 10:12 pm
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.
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.
- Sajt
- Posts: 1215
- Joined: Sat Oct 16, 2004 3:39 am
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!
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
-

ajay - Posts: 559
- Joined: Fri Oct 29, 2004 6:44 am
- Location: Swindon, UK
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.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
getButterfly - WordPress Support Services
Roo Holidays
Fear not the dark, but what the dark hides.
-

Chip - Posts: 575
- Joined: Wed Jan 21, 2009 9:12 am
- Location: Dublin, Ireland
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.
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.
I was once a Quake modder
-

Urre - Posts: 1109
- Joined: Fri Nov 05, 2004 2:36 am
- Location: Moon
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest