Jump to content

Recommended Posts

Posted

it is safe to assume that pushforce has not yet been deprecated ? its so fun I dont REALLY care . but just drew my curiosity . I cant help but wonder how the networking is . Im sure someone should have a good reliable report on it . ty and have a nicey 👍 .

Posted

Azaezel , please excuse me and my jibberish . I recently discovered the physic shape and rigid shape class stuffs . being very impressed I began searching for something to apply force in the same manner for the player character object or avatar or what have you . I couldn't find anything that worked then recalled the player server code from 1.2 that would  , as you correctly discerned despite my jibberish , applyImpule and simply effortlessly push whatever class of object right away with not the slightest stuttering of the programmic action , if you will . I added it to the player oncollision callback in 4.01 and it works so well . I just wondered if this or some other method is currently being resorted to . BTW I use the 4.01 binary .

this is the part of the oncollision function copied from 1.2 I think its original GG and was presented in the book by Kenneth C Finney 4D Game Programming All-In-One .

This works beautifully IMO and there is no problem here but , if there's a more modern approach I'd dig hearing about it . clear as mud? 🖍️       TY.

	
	if ((%col.getClassName() !$= "wheeledVehicle") || (%col.getClassName() !$= "item"))
	{
	if (vectorLen(%col.getvelocity) <= 2.0) { 
 %pushForce = %obj.getDataBlock().pushForce;  // Try to push the object away
     if (!%pushForce){
       %pushForce = %obj.getdatablock().pushforce;
	   }
 %eye = %obj.getEyeVector();                   // Start with the shape's eye vector...
 %vec = vectorScale(%eye, %pushForce);
 %vec = vectorAdd(%vec,%obj.getVelocity());    // Add the shape's velocity
 %pos = %col.getPosition();                    // then push
 %vec    = getWords(%vec, 0, 1) @ " 0.0";
 %col.applyImpulse(%pos,%vec);
	 }	
	}	
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...