Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to draw a 3d arrow in a 3d box (well lots of them actually). I've got the 3d box sorted, but the arrow doesn't look quite right. I've set up my axes/projection with:

\usepackage{tikz-3dplot}
\tdplotsetmaincoords{90}{90}
\tdplotsetrotatedcoords{0}{20}{70}

But the arrows don't obey the projection, they're 2d but don't look flat on the xy plane of the box, they're still flat with respect to the page. Does anyone know how to fix this?

Also, ideally I'm looking for a big 3d block arrows but I can't find any examples of this, any ideas?

Cheers.

Edit: As requested, here's a MWE:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows}
\tikzset{>=latex}

\usepackage{tikz-3dplot}
\tdplotsetmaincoords{90}{90}
\tdplotsetrotatedcoords{0}{20}{70}

\begin{document}
\begin{tikzpicture}
\begin{scope}[fill={rgb:red,1;green,2;blue,10},fill opacity=0.4]
\draw [fill] (0,0,0)--(4,0,0)--(4,4,0)--(0,4,0)--cycle;
\draw [fill] (0,0,0)--(4,0,0)--(4,0,1)--(0,0,1)--cycle;
\draw [fill] (0,0,0)--(0,4,0)--(0,4,1)--(0,0,1)--cycle;
\draw [fill] (4,0,0)--(4,4,0)--(4,4,1)--(4,0,1)--cycle;
\draw [fill] (4,4,0)--(0,4,0)--(0,4,1)--(4,4,1)--cycle;
\draw [fill] (0,0,1)--(4,0,1)--(4,4,1)--(0,4,1)--cycle;
\end{scope}

\begin{scope}[->, ultra thick]
\draw[->] (2,2,1/2)--++(180:1.5)--++(0:3);
\end{scope}
\end{tikzpicture}
\end{document}

The result:

Hopefully you can see the problem, it doesn't look like the arrow is in the box, it's just been laid over the top.

share|improve this question
2  
Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  egreg Dec 21 '13 at 22:42
    
Possibly relevant (but not a duplicate): tex.stackexchange.com/q/51340/484 –  Charles Staats Dec 23 '13 at 16:54
    
I am also interested in an answer to his question if it would include a 3D shaped arrow with cylindric rod too. @user3087409: TikZ creates the picture layer by layer, so the code after creating the box will lay on top of it. –  strpeter Dec 31 '13 at 9:42
1  
@strpeter a 3d arrow with cylindrical rod would be perfect. I'm fine with the code after the box laying stuff on top, but I don't want it to look like that's happening. –  user3087409 Jan 2 '14 at 11:22
    
Manually you could use Slant from arrows.meta library. –  Manuel Jun 9 at 22:05

1 Answer 1

You did not use the main coordinate that you've set up. To use it add [tdplot_main_coords] after \begin{tikzpicture}:

\begin{tikzpicture}[tdplot_main_coords]

If you do this, you will get blue rectangle with upward arrow from the center because the first parameter of \tdplotsetmaincoords is the angle (in degrees) through which the coordinate frame is rotated about x axis and the second parameter is rotated about z axis. Read tikz-3dplot documentation for more detailed explanation: http://mirrors.ctan.org/graphics/pgf/contrib/tikz-3dplot/tikz-3dplot_documentation.pdf

90-90 view

If you change \tdplotsetmaincoords{90}{90} to \tdplotsetmaincoords{100}{20} you will have this:

100-20 view

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.