About Store Forum Documentation Contact



Post Reply 
Getting Velocity and Obj components (?)
Author Message
Ioannis Offline
Member

Post: #1
Getting Velocity and Obj components (?)
- What's the best way to get the player's (or a character's in general) actual velocity in game? I wrote a custom function to get it based on current and past pos() per frame but I'm sure there's a better way to do it and I wouldn't want to do this every single time I need velocity values.

- What's the best way to access the components of an object? i.e. collision primitive.
04-04-2020 05:31 PM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #2
RE: Getting Velocity and Obj components (?)
1. You can use Actor data to get it, Actor.vel(). Character itself doesn't have velocity, but its Actor does.
2. Just as class variables? (or I didn't understand the question)
(This post was last modified: 04-04-2020 07:54 PM by Houge.)
04-04-2020 07:53 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Ioannis Offline
Member

Post: #3
RE: Getting Velocity and Obj components (?)
1. Getting the vel from the actor worked really well! Much better than my own implementation using the pos(). Thanks!
2. Just interested in scaling down the capsule collision on crouch.
(This post was last modified: 04-04-2020 08:39 PM by Ioannis.)
04-04-2020 08:34 PM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #4
RE: Getting Velocity and Obj components (?)
Look at Controller class, it has the scaling for crouching.
(Game::Chr uses it)
(This post was last modified: 04-04-2020 10:04 PM by Houge.)
04-04-2020 10:04 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Ioannis Offline
Member

Post: #5
RE: Getting Velocity and Obj components (?)
Found it, thanks a lot!
04-04-2020 11:14 PM
Find all posts by this user Quote this message in a reply
Post Reply