unity – How to get the same results as GetAxis his acceleration from MoveTowards?

I want to have a similar effect like on GetAxis, that it smoothes out the end of the movement on the MoveTowards function.
I have a Dog following the player but also have a script where you can control the dog, on the controlling dog script I have GetAxis but I want to have a similar effect on the dog following player script and I have no clue how to do it.

I want the effect to happen in the ChaseTarget() function

My Dog follow player script:

   (Header("Move Options"))
private float _followSpeed;
(SerializeField) private float _moveSpeed = 5f;
(SerializeField) private bool _following = false;
private Rigidbody2D _rigidbody2D;
(Space)
(Header("Target"))
public GameObject _target;
public GameObject _Ivan;
private Vector3 _targetPosition;
(SerializeField) private float _stopDistance = 0.5f;
(SerializeField) private float _startFollowDistance = 2f;
private float distanceBetweenToniAndIvan;
(SerializeField) private bool _stopHere = false;
(Space)
(Header("Animation"))
public Animator _doggoAnim;

void Start()
{
    _stopHere = false;
    _following = false;
    _rigidbody2D = GetComponent<Rigidbody2D>();
    _doggoAnim = GetComponent<Animator>();
}

private void Update()
{
    _followSpeed = _moveSpeed * Time.deltaTime;
    //Distance between A obj and B obj
    Distance();
    //Checks if Toni is too close to _target
    CheckIfDoggoIsTooClose();
    //Face _target direction
    FaceDirection();
    //Idle to Walk animation
    DoggoAnimation();

    //Moves Doggo to _target
    if (_following && !_stopHere)
    {
        ChaseTarget();
    }
}

void FixedUpdate()
{

}

private void Distance()
{
    //get only x Axis position from Target
    _targetPosition = new Vector3(_target.transform.position.x, transform.position.y, 0f);
    //Calculates distance between 2 objects
    //distanceBetweenToniAndIvan = Vector3.Distance(new Vector3(transform.position.x, 0f, 0f), new Vector3(_target.transform.position.x, 0f, 0f));
    distanceBetweenToniAndIvan = Vector3.Distance(transform.position, _target.transform.position);
}
private void CheckIfDoggoIsTooClose()
{
    //Checks if _target entered startFollowDistance && if startFollowDistance is bigger then stopDistance
    if (distanceBetweenToniAndIvan < _startFollowDistance && _startFollowDistance > _stopDistance)
    {
        _following = true;
    }
    else
        _following = false;
    //Checks if Doggo is too close to _target then stops //Else follow again
    if (distanceBetweenToniAndIvan <= _stopDistance)
    {
        _stopHere = true;
    }
    else
        _stopHere = false;
}

private void ChaseTarget()
{
    float moveX = Input.GetAxis("Horizontal");
    //move right
    if(transform.position.x < _target.transform.position.x)
    {
        transform.position = Vector2.MoveTowards(transform.position, _targetPosition, _followSpeed);
        //_rigidbody2D.velocity += new Vector2(_moveSpeed, 0f).normalized;
    }
    //move left
    else if(transform.position.x > _target.transform.position.x)
    {
        transform.position = Vector2.MoveTowards(transform.position, _targetPosition,  _followSpeed);
        //_rigidbody2D.velocity += new Vector2(-_moveSpeed, 0f).normalized;
    }
}
private void FaceDirection()
{
    if (!_stopHere && _doggoAnim.GetBool("isWalking") == true)
    {
        //_target is to the left so move right
        if (transform.position.x < _target.transform.position.x)
            this.GetComponent<SpriteRenderer>().flipX = false;
        //_target is to the right so move left
        if (transform.position.x > _target.transform.position.x)
            this.GetComponent<SpriteRenderer>().flipX = true;
    }
}
private void DoggoAnimation()
{
    if(_following && !_stopHere)
    {
        _doggoAnim.SetBool("isWalking", true);
    }
    if(!_following || _stopHere)
    {
        _doggoAnim.SetBool("isWalking", false);
    }

}

Curves – acceleration on manifolds – a research

I am interested in the acceleration on Riemman manifolds. There might be some work there, but I am missing keywords to start my research and implementations on the matter.

I already know that a geodesic is a constant velocity curve and is connected to points on a manifold that I think is smooth and without singularities. However, there can be several minima because we want to do something interesting. Could you enlighten me on a first search?

Regards,
Bruno Peixoto

Movement – How are wind boxes attached when the acceleration of the wind is less than the friction of the object?

I'm doing a bird's eye view Zelda-like adventure game (Open Beta here). I want creature sprites to have two movement modes – walking where they can stop and start immediately and move at a set speed, and running where they start at walking speed and slowly accelerate to their maximum speed and slow down when they do stop motion based on a friction value.

Because units can move in either direction along two axes, I can't just use if-then statements based on whether they point left or right. Instead, I add their friction value to their acceleration vector and then brake them by their friction value. This way they can realistically glide around at high speeds, maintain their speed on wide turns, etc. So far, so well.

To cope with walking, both the friction and the acceleration at a speed below the walking speed are set exactly to the walking speed, generally between 1 and 3 pixels per image. They start to move with (acc + frict), then their speed is reduced by friction, leaving them at walking pace. It works well.

The problem is that I also want the game to have wind boxes that push the player around. However, many of these winds must be relatively weak and accelerate more slowly than walking. For this reason, light winds have no effect on sprites that are not moving. Their friction slows them down before the acceleration of the wind updates their position.

The flow per frame is as follows:

Calculate movement acceleration based on input
If speed < walking_speed, set acc and frict to walking_speed, 
else set acc to running_acc and frict to running_frict
If running, set max_speed to running_speed,
else set max_speed to walking_speed
Apply acceleration (acc + frict) to velocity (will not accelerate past max_speed, but does not actually cap speed value)
Apply deceleration (frict) to velocity
Move position according to velocity
Calculate all hitbox and windbox collisions
Apply hitbox and windbox acceleration to velocity

How can you deal with it effectively?

04/18 – Why aren't Virtualbox 2D acceleration settings saved?

I run Ubuntu 04/18/03 as a host and have a guest of window 10 (both 64 bit). Virtualbox version 6. I installed guest add-ons and 3D acceleration works, but if I need to display and check the 2D acceleration checkbox and click OK, it won't be saved. As soon as I go back, it is deactivated again. I am not sure what this error is and would appreciate any help. I've been trying to fix this error for quite a while.

I am currently assuming that either a) my Virtualbox Edition has a problem or b) 2D acceleration is not supported, but if this is not supported, I would have expected the checkbox to be greyed out …

Thank you in advance 🙂

Performance – Boggle Solver in Rust – Looking for acceleration

I recently developed a boggle solver in Rust to compensate for the fact that I'm really bad at the boggle. This was also a good learning experience for Rust. The code does what it is supposed to do quite well, but is also a little slow to compile with it -O Flag. Since I'm new to Rust, I'm not sure where the slow spots could be. I use a hash set to look up the words, so I assume that looking up is not the bottleneck. Any tips? (Even if I practice poorly, you can let me know). Thank you very much.

use std::collections::HashSet;
use std::fs;

const MAX_WORD_LEN: usize = 12;


#(derive(Clone, Debug, Copy))
struct Coordinate {
    row: i64,
    col: i64
}


impl Coordinate {
    // Returns a new coordinate if the move is valid. None otherwise.
    fn move_c(&self, a: i64, b: i64, h: i64, w: i64) -> Option {
        let h_range = 0..h;
        let w_range = 0..w;
        if h_range.contains(&(self.row + a)) && w_range.contains(&(self.col + b)) {
            Some(Coordinate {row: self.row + a, col: self.col + b}) 
        } 
        else {
            None
        } 
    }
}

impl PartialEq for Coordinate {
    fn eq(&self, other: &Self) -> bool {
        self.row == other.row && self.col == other.col
    } 
}


fn boggle_solve(grid: &Vec>, dict: &HashSet) {
    for (i, row) in grid.iter().enumerate() {
        for (j, ch) in row.iter().enumerate() {
            boggle_solve_help(grid, dict, ch.to_string(), Coordinate{row: i as i64, col: j as i64}, vec!(Coordinate{row: i as i64, col: j as i64}))
        }
    }

}


fn boggle_solve_help(grid: &Vec>, dict: &HashSet, word: String, c: Coordinate, path: Vec) {
    // Base case.
    // No more work if the string is long enough
    if word.len() > MAX_WORD_LEN {
        return;
    }

    if word.len() > 3 && dict.contains(&word) {
        println!("{}", word);
    }

    // For every possible direction the path can take, if it is valid, take it.
    for a in -1..=1 {
        for b in -1..=1 {
           match c.move_c(a, b, grid.len() as i64, grid(0).len() as i64) {

                Some(new_c) if !path.contains(&new_c) => {
                    let mut new_path = path.clone();
                    new_path.push(new_c);
                    let new_word = format!("{}{}", &word, &grid(new_c.row as usize)(new_c.col as usize));

                    boggle_solve_help(grid, dict, new_word, new_c, new_path);
                },

                Some(_) => (),

                None => ()

           } 
        }
    } 
}

fn main() {
    let contents = fs::read_to_string("words_alpha.txt").unwrap();
    let dict: HashSet = contents.split_whitespace().map(|s| s.to_string()).collect();

    let grid: Vec> = vec!(
        vec!('c', 's', 't', 'e', 't'),
        vec!('a', 'i', 'r', 'l', 's'),
        vec!('p', 'd', 'a', 'e', 's'),
        vec!('u', 'e', 'c', 's', 'e'),
        vec!('r', 'o', 't', 'r', 'i')
    );

    boggle_solve(&grid, &dict)

}


bitcoind – calculation of the average speed and acceleration of Bitcoin transactions

I am working on a Bitcoin project and would like to extract the following functions

1- Average speed: Indicates the speed at which bitcoins flow to a user

2- Average acceleration: Indicates the acceleration of bitcoin flow for a user

I have the following characteristics:

  • User ID (represents the user)
  • the total number of transactions (e.g. 100 transactions)
  • the total value of the Bitcoin transferred (e.g. 10,000 BTC)
  • the date of each transaction (corresponds to the date of each transaction)
    Transaction)

Can you please help me calculate speed and acceleration?

Thanks for any help you can provide

Greetings,

Khaled

Algorithms – Is it possible to estimate the step size and walking speed of different persons with the x-y-z acceleration data of 6 axial acceleration sensors?

I have a 6-axis scanner that records the acceleration data. There is an algorithm for counting the number of steps and the user's walking distance, but I want to further increase the accuracy of the result. I want to write an algorithm that calculates the step size and walking speed of the person. Is it possible ?

RTS Camera Acceleration – Game Development Stack Exchange

I have a RTS game with a camera that can be controlled by either Edge Pan, Gamepad Analog Stick or Keyboard Keys (WASD). The speed and speed are good for the general case, but sometimes it feels too slow when you drive to far away places on the map.
What is a good algorithm to implement some kind of acceleration into the camera without feeling less snappy? Preferably, this algorithm should work best for the analog stick, as mouse + keyboard can easily use the minimap to navigate.