# Why can't we pass PVector to translate?

**URL:** https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888
**Category:** Beginners
**Created:** [January 27, 2019, 8:40pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888 "2019-01-27T20:40:15Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Geeky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geeky/32/15948_2.png) [@Geeky](https://discourse.processing.org/u/Geeky)
#### Post date: [January 27, 2019, 8:40pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/1 "2019-01-27T20:40:15Z")

</div>

I’ve just started using P3D and while translating a cube I wonder that why can’t we pass a variable of type PVector to translate method. I think that functionality wise it should work. Correct me if I am wrong.

---

<div class="post-metadata">

### Author: ![BennyHacker](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bennyhacker/32/2969_2.png) [@BennyHacker](https://discourse.processing.org/u/BennyHacker)
#### Post date: [January 27, 2019, 8:59pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/2 "2019-01-27T20:59:39Z")

</div>

This is something I’ve often wondered as well. If you’re tired of writing out all the x, y and z variables I’d make a custom class that looks like this

```auto
void Translate(PVector p){
  translate(p.x,p.y,p.z);
}
void Translate2(PVector p, PShape s){
  s.translate(p.x,p.y,p.z);
}

```

Although there may be some specific cases where this won’t work, possibly inside of the beginShape() function.

---

<div class="post-metadata">

### Author: ![clankill3r](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/clankill3r/32/1098_2.png) [@clankill3r](https://discourse.processing.org/u/clankill3r)
#### Post date: [January 27, 2019, 10:47pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/3 "2019-01-27T22:47:57Z")

</div>

Don’t use a capital for a method name, it’s against conventions.  
Also you can just name it `translate`, function overloading will take care of it. That is, because you call it with a PVector for example it will know that it needs to call translate that accepts as PVector as a argument.

---

<div class="post-metadata">

### Author: ![Quertz](https://avatars.discourse-cdn.com/v4/letter/q/cc9497/32.png) [@Quertz](https://discourse.processing.org/u/Quertz)
#### Post date: [February 5, 2019, 4:15pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/4 "2019-02-05T16:15:53Z")

</div>

It´s not too hard to build your own Transformation-Class that passes your Rotations or Translations through to P3D and takes Vektors or Vektors with Angles and so far from the using coder.

---

<div class="post-metadata">

### Author: ![Geeky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/geeky/32/15948_2.png) [@Geeky](https://discourse.processing.org/u/Geeky)
#### Post date: [February 5, 2019, 4:33pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/5 "2019-02-05T16:33:29Z")

</div>

Yes i agree. Still i think that their should be an overridden translate method which can take PVector as a parameter, as main aim of Processing is to enable artists and non-coders to build what they imagine rather not to learn how to code before starting.

---

<div class="post-metadata">

### Author: ![Dcpb](https://avatars.discourse-cdn.com/v4/letter/d/eb8c5e/32.png) [@Dcpb](https://discourse.processing.org/u/Dcpb)
#### Post date: [November 25, 2020, 10:16pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/6 "2020-11-25T22:16:40Z")

</div>

I’m writing an orbit. Same problem.

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [November 25, 2020, 11:07pm UTC](https://discourse.processing.org/t/why-cant-we-pass-pvector-to-translate/7888/7 "2020-11-25T23:07:15Z")

</div>

> [@BennyHacker](#):
>
> ```auto
> void translate(PVector p){
> translate(p.x,p.y,p.z);
> }
> void translate2(PVector p, PShape s){
> s.translate(p.x,p.y,p.z);
> }
> 
> ```

you can use these functions
