Ooops
January 26, 2021, 06:39:11 AM

### Author Topic: [bb] Pushing Objects by Neochrome [ 1+ years ago ]  (Read 552 times)

#### BlitzBot

• Jr. Member
• Posts: 1
##### [bb] Pushing Objects by Neochrome [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Pushing Objects
Author : Neochrome
Posted : 1+ years ago

Description : Basically i came up with this idea after playing unreal! it works!!!

this is a snippet from my game but its so easy i thought id share it, Its very basic so there are some things i haven

Code :
Code: BlitzBasic
1. (I let this code free)
2.
3. [codebox]
4. If lpEnvpushable=True
5.         ;translateentity lpEnvmodel,0,-.1,0
6.         z = EntityCollided(ThisActor, coll_objects)
7.         If z = lpEnvmodel
8.                 i=1
9.                 ; Calculate bounce:
10.                 ; Get the normal of the surface which the entity collided with.
11.                 Nx# = CollisionNX(ThisActor%, i)
12.                 Ny# = CollisionNY(ThisActor%, i)
13.                 Nz# = CollisionNZ(ThisActor%, i)
14.
15.                 vy# = VectorYaw(-nx, -ny, -nz)
16.
17.                 tfm_z# = Cos(vy#)/5
18.                 tfm_x# = -Sin(vy#)/5
19.                 tfm_y# = VectorPitch(-nx, -ny, -nz)
20.                 If Abs(tfm_y)<60 Then TranslateEntity lpEnvmodel,tfm_x,0,tfm_z
21.         End If
22. End If
23. [/codebox]