Raised This Month: $51 Target: $400
 12% 

Bouncing Props?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shine771
Senior Member
Join Date: Jun 2007
Old 12-25-2010 , 20:43   Bouncing Props?
Reply With Quote #1

Today I started learning SourcePawn. I've got some experience with amxmodx. I was wondering, how can I make a bouncy prop_physics_multiplayer entity?
I've looked through movetypes and flags and I couldn't find anything. I've tried hooking Touch with SDKHooks and make the bouncing myself, but it doesn't detect when entity touches world. Assuming GetEntityFlags() works correctly, I can catch the moment when entity touches ground(has FL_ONGROUND flag) and go from there.
I was wondering, is there an easier, built in way to make a prop bounce? Hooking Think and checking every frame if prop is on ground would probably be inefficient with a plugin.

Thanks.
shine771 is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 12-26-2010 , 03:52   Re: Bouncing Props?
Reply With Quote #2

Just making a prop_physics_multiplayer should do it. Though, you can't have turbo physics (sv_turbophysics) enabled if you want bouncy props.

Search for a prop spawner plugin for inspiration on how to spawn props. I don't know how to change class of existing entities.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
shine771
Senior Member
Join Date: Jun 2007
Old 12-26-2010 , 13:40   Re: Bouncing Props?
Reply With Quote #3

Believe me, I've tried everything. Before I posted, I had already made the prop_physics_mp entity, experimented with every property I could find that could somehow affect its bouncy-ness. I spent more than 2 hours searching and experimenting. Searched this forum 3 times. Tried searching VHE for entity properties, then web. Tried changing my model's material - nothing. Nothing seems to have any effect on the entity.
Then I found 'm_flElasticity' and 'm_flFriction' parameters, but they too have no effect on the entity. Tried changing its mass with 'm_massScale' and 'm_fMass'. Nothing I've tried so far works.
Believe me, I've tried everything. I wouldn't post here if I didn't do my research. This forum is my last resort.

Thanks.

P.s. Maybe someone misunderstood me. I want to make a bouncy prop that would actually Bounce. Like MOVETYPE_BOUNCE in HL1 engine.

Last edited by shine771; 12-26-2010 at 13:45.
shine771 is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 12-26-2010 , 15:01   Re: Bouncing Props?
Reply With Quote #4

have you tried setting movetype to MOVETYPE_FLYGRAVITY then adjusting "m_flElasticity". i know "m_flElasticity" changes bouncyness of projectiles in css which use MOVETYPE_FLYGRAVITY.
blodia is offline
shine771
Senior Member
Join Date: Jun 2007
Old 12-26-2010 , 15:24   Re: Bouncing Props?
Reply With Quote #5

I have - it just flew in the air - no physics, nothing.
Now I tried again and some weird stuff started happening. It still flew in the air solid, but there was another entity with the same index(physics model or something?) which moved around and was invisible. Sometimes I could feel it walking near the entity I spawned. I hooked touch and added a debug message which will show if I touch the entity. It showed the message when I touched my solid entity and the invisible one too.
Any ideas?

Thanks.
shine771 is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 12-26-2010 , 16:15   Re: Bouncing Props?
Reply With Quote #6

sorry forgot to mention the entity will lose its physics characteristics when its movetype is changed from MOVETYPE_VPHYSICS. physics props are made from 2 seperate objects, one that shows the actual model which has its own collision model and a seperate physics objects used for all physics calculations which also has its own collision model.
since you changed the movetype i'm guessing the physics object isn't staying in sync with the model.

you could try changing "m_MoveCollide" aswell

PHP Code:
enum MoveCollide_t 
{
    
MOVECOLLIDE_DEFAULT 0,

    
// These ones only work for MOVETYPE_FLY + MOVETYPE_FLYGRAVITY
    
MOVECOLLIDE_FLY_BOUNCE// bounces, reflects, based on elasticity of surface and object - applies friction (adjust velocity) 
    
MOVECOLLIDE_FLY_CUSTOM// Touch() will modify the velocity however it likes 
    
MOVECOLLIDE_FLY_SLIDE// slides along surfaces (no bounce) - applies friciton (adjusts velocity) 
    
    
MOVECOLLIDE_COUNT// Number of different movecollides 

    // When adding new movecollide types, make sure this is correct 
    
MOVECOLLIDE_MAX_BITS 
}; 

Last edited by blodia; 12-26-2010 at 16:21.
blodia is offline
shine771
Senior Member
Join Date: Jun 2007
Old 12-26-2010 , 17:25   Re: Bouncing Props?
Reply With Quote #7

Physics object is still 'loose'. Maybe it bounces, I don't know cause I cant see it. I tried getting entities origin. I thought it could return the physics object origin, but it returns model's origin. This thing is killing me.

Thanks.
shine771 is offline
TESLA-X4
Senior Member
Join Date: Dec 2008
Location: $Recycle.Bin
Old 12-26-2010 , 21:41   Re: Bouncing Props?
Reply With Quote #8

What you're looking for is governed by vphysics. Get the material index (IPhysicsObject::GetMaterialIndex()) of a prop_combine_ball (iirc it was 4) and apply it to the target prop (IPhysicsObject::SetMaterialIndex(int idx)).
TESLA-X4 is offline
shine771
Senior Member
Join Date: Jun 2007
Old 12-26-2010 , 22:22   Re: Bouncing Props?
Reply With Quote #9

And how can I do that in using SourcePawn?
I tried:
PHP Code:
FindSendPropInfo("CPhysicsObject","m_materialIndex");
// and
FindSendPropInfo("IPhysicsObject","m_materialIndex"); 
But it returned -1. I would really appreciate a code example.

Thanks.
shine771 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-27-2010 , 03:26   Re: Bouncing Props?
Reply With Quote #10

He posted some C++ functions = extension.
__________________
FaTony is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode