setting friction?

Posted By: ptmontgomery

setting friction? - 11/03/03 03:56

When trying to activate sounds that play when obkects collide, I've tried both enable_friction and phent_sefriction -in both cases I get error messages from the compiler. "Parameter unknown enable_friction Parameter".

Suggestions??
Posted By: ventilator

Re: setting friction? - 12/03/03 18:56

i have the same problem! why doesn't enable_friction work?
Posted By: fastlane69

Re: setting friction? - 12/04/03 08:02

enable_frinction is usable with ent_move.

phent_setfriction is usable with the Physics Engine.

You cannot mix these function....either use enable_friction and dont' register you object with the physics engine OR use phent_setfriction, which would require you register with teh physics engine, but you lose on any collision detection events; can't use any triggering or any enable commands refering to ent_move if registered with the physics engine
Posted By: ventilator

enable_friction keyword unknown!? - 12/16/03 07:30

i thought enable_friction is meant for physics objects? this really confuses me. a quote from the manual:

Quote:

EVENT_friction
entity.enable_friction

If a physics entity collides with another model, the physics entity will receive this event. TARGET and NORMAL are set to point of impact and hit surface normal, respectively. If two physics entities collide, each will receive an EVENT_FRICTION




did you use enable_friction recently? the keyword seems to be unknown. this is really strange!
Posted By: fastlane69

Re: enable_friction keyword unknown!? - 12/16/03 11:40

I had thought that I couldn't do any event handling concerning moving if I was currently registered with the PE. Also, as I look at the diffrent events, they all refer to ent_move or c_ent_move. Friction and Block "seems" to be the only events that uses the word "physics" in it; perhaps a relic of the accelerate days?

But no, I have not used .enable_friction lately since I use the PE for my friction, hence I use phent_setfrictio.
Posted By: Marco_Grubert

Re: enable_friction keyword unknown!? - 12/17/03 12:31

Strange. The code is still there, as is the defintion for EVENT_FRICTION, but I can't find ENABLE_FRICTION either. Must have gotten deleted by accident.

Phent_setfriction() only sets the automatic friction handling- it's not related to user event handling at all. The right way as you stated is to use ENABLE_FRICTION and then define an EVENT_FRICTION handler.
Posted By: fastlane69

Re: enable_friction keyword unknown!? - 12/17/03 12:37

So am I right in saying that using the PE you can't use collision detection event handleing or can we still use events while under the control of the PE?
Posted By: jcl

Re: enable_friction keyword unknown!? - 12/17/03 18:55

I confirm that enable_friction was not there. Somehow it didn't make it in the final 6.2 version - I suspect that it was accidentally deleted.

There is a workaround to set enable_friction. Try the following:

my.skill_a |= 1>>4;

(not tested yet, but should do the trick).
Posted By: fastlane69

Re: enable_friction keyword unknown!? - 12/18/03 05:12

I don't see it JCL. What is my.skill_a? That's a particle skill, isn't it? Why would right shifting a particle skill be a work around to enable_friction...

Posted By: qwerty823

Re: enable_friction keyword unknown!? - 12/18/03 08:40

My "guess" is that skill_a and the value that holds the enable_* flags has the same offset in the C struct, so one becomes the same as the other. This makes sense in a way since things like .x and .pan can be interchanged with things needing a vector.
Posted By: qwerty823

Re: enable_friction keyword unknown!? - 12/18/03 09:02

I just confirmed it using the SDK and a debugger. They are at the same offsets. I wonder what other cool tricks can be done this way.
Posted By: Marco_Grubert

Re: enable_friction keyword unknown!? - 12/18/03 13:42

Particles and entities are stored in a similar way in memory, those bits used for particle effects are recycled as event bits in regular entities. The |= is merely a way of setting a single bit rather than a whole bunch of them.

Posted By: fastlane69

Re: enable_friction keyword unknown!? - 12/18/03 15:01

Whats the name and function of the "|=" operator? Not familiar with it.
Posted By: qwerty823

Re: enable_friction keyword unknown!? - 12/19/03 02:50

The | (pipe symbol) is the bitwise 'OR' operator. The |= is just a shortcut like += is.

x += 2; // Same as x = x + 2;

x |= 2; // Same as x = x | 2;

As far as bitwise operators go, there are also the & (bitwise AND) and ^ (bitwise XOR), although Im not sure if C-Script supports them all.

If you want more info, let me know. Im sure I can dig up a link that explains them better.
Posted By: fastlane69

Re: enable_friction keyword unknown!? - 12/19/03 16:51

LOL! Right on!
Two months ago, I started giving bitwise ops any attention. Now, I use "the pipe" all the time. That shortcut caught me by surprise

Thanks!

(PS: I use & and ^ all the time in c-script, so yes, they do work )
© 2024 lite-C Forums