Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

Custom Physics

$
0
0
Hello,

I am trying to implement my physics solution. I need something 2D and very simple & fast (specially considering Fixed Point math). I have basic collision working, but I am not sure how to implement it with TrueSync.

For example - I was hoping to have my Physics Engine main loop be run on OnSyncedUpdate() on a True Sync gameObject.
All of my physics objects inherit from TrueSyncBehaviour.


This is my pseudo code, inside the main loop:

- initialize all new shapes (remove old ones)
- Move shapes
- Handle triggers
- Finally, run CustomUpdate on each object (if any).


I have 2 questions so far:
1) Should this main loop work, or not? I am assuming it does - because even though I am accessing each object through custom method -- all objects are accessed through 1 OnSyncedUpdate on main loop.

2) I notice some methods can't be run this way (through main loop) due to player ownership.
Since a player is also a shape (that collides other shapes), I need it to use the same physics main loop.
Do you have a recommendation how to work around this?
Right now I am getting Warning: 'You can't access an input in a TrueSyncBehaviour that has no player owner.'
I could move the player code, to OnSyncedUpdate(). But then I don't know how to fit it into my main physics loop.
Or to put it into another way:
How would I call a method on the object containing "TrueSyncInput.GetInt(INPUT_KEY);" but not through "OnSyncedUpdate" but through some other method instead (indirectly calling OnSyncedUpdate).


I hope these make sense.

Thanks,
Kreso

Viewing all articles
Browse latest Browse all 15755

Trending Articles