pst-vehicle: How to attach any object to the truck?

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-vehicle}
\psset{unit=4cm}
\begin{document}
\begin{pspicture}[showgrid](4,3)
\def\FuncA{0.5*cos(x)+1}
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\Truck,showSlope=false]{0.2}{0.5}{\FuncA}
\pcline[linestyle=none](!xMTg yMTg)%
      (!xMTg mTgy 0 ge { mTgx } { mTgx neg } ifelse add yMTg mTgy abs add)
\ncput{\rnode{MP}{}}\psdot(MP)
\psline[arrowscale=2]{->}(MP)(!\psGetNodeCenter{MP}MP.x MP.y 1 sub) 
%
\psVehicle[vehicle=\Truck,showSlope=false]{0.2}{2.0}{\FuncA}
\pcline[linestyle=none](!xMTg yMTg)%
    (!xMTg mTgy 0 ge { mTgx } { mTgx neg } ifelse add yMTg mTgy abs add)
\ncput{\rnode{MP}{}}\psdot(MP)
\psline[arrowscale=2]{->}(MP)(!\psGetNodeCenter{MP}MP.x MP.y 1 sub) 
\end{pspicture}
\end{document}

enter image description here


I have uploaded a new version of pst-vehicle.tex (The changes should become available on the mirrors of CTAN within the next 24 hours.) that allows you to use a node with the name GravC. See the following example and test the commented-out lines.

\documentclass[border=12pt,pstricks]{standalone}
\usepackage{pst-vehicle}
\psset{unit=4cm}
\begin{document}
\begin{pspicture}[showgrid](4,3)
%\psset{GravNode=dA12 1}% Vorderradachse aber um 1 nach oben
%\psset{GravNode=0 0}% Hinterradachse
%\psset{GravNode=dA12 2 div 1}% Voreinstellung
\def\FuncA{0.5*cos(x)+1}
\psplot{0}{4}{\FuncA}
\psVehicle[vehicle=\Truck,showSlope=false]{0.2}{0.5}{\FuncA}
\psdot(GravC)
\psline[arrowscale=2]{->}(GravC)([offset=-1]GravC)
%
\psVehicle[vehicle=\Truck,showSlope=false]{0.2}{2.0}{\FuncA}
\psdot(GravC)
\psdot[linecolor=red](GravC)
\psline[arrowscale=2]{->}(GravC)([offset=-1]GravC)
\end{pspicture}
\end{document}

Tags:

Pstricks